Skip to content

Commit

Permalink
remove hardcoded Permission model (#150)
Browse files Browse the repository at this point in the history
I use my own Permission model instead of the default one. But your permission generator uses the hardcoded spatie version instead of the one specified in the permission config.

This small fix is to just use the correct Model :-D
  • Loading branch information
webpatser authored Jan 30, 2024
1 parent cd12e27 commit 38b90e1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Commands/Permission.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use Illuminate\Support\Str;
use ReflectionClass;
use ReflectionException;
use Spatie\Permission\Models\Permission as PermissionModel;

class Permission extends Command
{
Expand All @@ -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}';
Expand All @@ -32,6 +31,7 @@ public function __construct()
{
parent::__construct();
$this->config = config('filament-spatie-roles-permissions.generator');

}

/**
Expand All @@ -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);
}
}

Expand Down

0 comments on commit 38b90e1

Please sign in to comment.