1. Go to this page and download the library: Download flametrench/laravel library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Flametrench\Identity\IdentityStore;
use App\Identity\PostgresIdentityStore;
public function register(): void
{
$this->app->singleton(IdentityStore::class, function ($app) {
return new PostgresIdentityStore($app->make(\PDO::class));
});
}
use Flametrench\Tenancy\TenancyStore;
class OrgController
{
public function __construct(private readonly TenancyStore $tenancy) {}
public function store(Request $request): JsonResponse
{
$result = $this->tenancy->createOrg(
$request->user()->id,
name: $request->input('name'),
slug: $request->input('slug'),
);
return response()->json($result['org']);
}
}
use Flametrench\Laravel\Facades\Flametrench;
$user = Flametrench::identity()->getUser($usrId);