1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 10:54:04 +00:00

Rework model discovery

This commit is contained in:
lukinovec 2023-06-06 15:46:50 +02:00
parent 3bfef9e2c4
commit 4175ac07bd
2 changed files with 39 additions and 11 deletions

View file

@ -20,6 +20,7 @@ use Illuminate\Database\Eloquent\Concerns\HasUuids;
use Stancl\Tenancy\Jobs\CreatePostgresUserForTenant;
use Stancl\Tenancy\Listeners\RevertToCentralContext;
use Stancl\Tenancy\Bootstrappers\Integrations\PostgresRLSBootstrapper;
use Stancl\Tenancy\Tenancy;
beforeEach(function () {
DB::purge($centralConnection = config('tenancy.database.central_connection'));
@ -27,6 +28,8 @@ beforeEach(function () {
Event::listen(TenancyInitialized::class, BootstrapTenancy::class);
Event::listen(TenancyEnded::class, RevertToCentralContext::class);
Tenancy::$modelDirectories = [__DIR__ . '/Etc'];
// Turn RLS scoping on
config(['tenancy.database.rls' => true]);
config(['tenancy.bootstrappers' => [PostgresRLSBootstrapper::class]]);