diff --git a/src/Commands/Permission.php b/src/Commands/Permission.php index 50c998e..1dd09c0 100644 --- a/src/Commands/Permission.php +++ b/src/Commands/Permission.php @@ -10,7 +10,6 @@ use Illuminate\Support\Str; use ReflectionClass; use ReflectionException; -use Spatie\Permission\Models\Permission as PermissionModel; class Permission extends Command { @@ -20,8 +19,8 @@ class Permission extends Command private array $policies = []; - protected $signature = 'permissions:sync - {--C|clean} + protected $signature = 'permissions:sync + {--C|clean} {--P|policies} {--O|oep} {--Y|yes-to-all}'; @@ -32,6 +31,7 @@ public function __construct() { parent::__construct(); $this->config = config('filament-spatie-roles-permissions.generator'); + } /** @@ -50,9 +50,11 @@ public function handle(): void $this->prepareCustomPermissions(); + $permissionModel = config('permission.models.permission'); + foreach ($this->permissions as $permission) { $this->comment('Syncing Permission for: '.$permission['name']); - PermissionModel::firstOrCreate($permission); + $permissionModel::firstOrCreate($permission); } }