Preserva base local aceite de identidade e acessos

This commit is contained in:
Codex
2026-10-25 21:29:22 +02:00
commit 26b80df545
112 changed files with 13259 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
<?php
namespace App\Modules\Identity\Models;
use App\Shared\Context\BelongsToCompany;
use Illuminate\Database\Eloquent\Model;
final class Unit extends Model
{
use BelongsToCompany;
protected $fillable = ['name'];
protected static function booted(): void
{
static::addGlobalScope('unit-access', function (\Illuminate\Database\Eloquent\Builder $query): void {
$query->whereIn('units.id', app(\App\Shared\Context\CompanyContext::class)->permittedUnitIds());
});
}
}