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

Delete dump, use getTenantModels

This commit is contained in:
lukinovec 2023-06-16 11:08:07 +02:00
parent 89d9e20c38
commit 1fd1aa7ad6

View file

@ -20,7 +20,7 @@ class CreateRLSPoliciesForTenantTables extends Command
public function handle(): int
{
DB::transaction(function () {
tenancy()->getModels()->each(fn (Model $model) => $this->useRlsOnModel($model));
tenancy()->getTenantModels()->each(fn (Model $model) => $this->useRlsOnModel($model));
});
return Command::SUCCESS;
@ -34,7 +34,6 @@ class CreateRLSPoliciesForTenantTables extends Command
$table = $model->getTable();
$tenantKey = tenancy()->tenantKeyColumn();
dump($model::class, 'dropping policy of ' . $table);
DB::statement("DROP POLICY IF EXISTS {$table}_rls_policy ON {$table}");
if (tenancy()->modelBelongsToTenant($model)) {