mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 09:04:03 +00:00
Delete dump, use getTenantModels
This commit is contained in:
parent
89d9e20c38
commit
1fd1aa7ad6
1 changed files with 1 additions and 2 deletions
|
|
@ -20,7 +20,7 @@ class CreateRLSPoliciesForTenantTables extends Command
|
||||||
public function handle(): int
|
public function handle(): int
|
||||||
{
|
{
|
||||||
DB::transaction(function () {
|
DB::transaction(function () {
|
||||||
tenancy()->getModels()->each(fn (Model $model) => $this->useRlsOnModel($model));
|
tenancy()->getTenantModels()->each(fn (Model $model) => $this->useRlsOnModel($model));
|
||||||
});
|
});
|
||||||
|
|
||||||
return Command::SUCCESS;
|
return Command::SUCCESS;
|
||||||
|
|
@ -34,7 +34,6 @@ class CreateRLSPoliciesForTenantTables extends Command
|
||||||
$table = $model->getTable();
|
$table = $model->getTable();
|
||||||
$tenantKey = tenancy()->tenantKeyColumn();
|
$tenantKey = tenancy()->tenantKeyColumn();
|
||||||
|
|
||||||
dump($model::class, 'dropping policy of ' . $table);
|
|
||||||
DB::statement("DROP POLICY IF EXISTS {$table}_rls_policy ON {$table}");
|
DB::statement("DROP POLICY IF EXISTS {$table}_rls_policy ON {$table}");
|
||||||
|
|
||||||
if (tenancy()->modelBelongsToTenant($model)) {
|
if (tenancy()->modelBelongsToTenant($model)) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue