Skip to content

Commit

Permalink
Merge pull request #358 from makss/fix_reset_cache
Browse files Browse the repository at this point in the history
Fix reset cache
  • Loading branch information
pxpm authored Apr 25, 2024
2 parents 8f14bdb + 268ce5e commit 4263672
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/app/Http/Controllers/PermissionCrudController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Backpack\CRUD\app\Http\Controllers\CrudController;
use Backpack\PermissionManager\app\Http\Requests\PermissionStoreCrudRequest as StoreRequest;
use Backpack\PermissionManager\app\Http\Requests\PermissionUpdateCrudRequest as UpdateRequest;
use Spatie\Permission\PermissionRegistrar;

// VALIDATION

Expand Down Expand Up @@ -62,7 +63,7 @@ public function setupCreateOperation()
$this->crud->setValidation(StoreRequest::class);

//otherwise, changes won't have effect
\Cache::forget('spatie.permission.cache');
app()->make(PermissionRegistrar::class)->forgetCachedPermissions();
}

public function setupUpdateOperation()
Expand All @@ -71,7 +72,7 @@ public function setupUpdateOperation()
$this->crud->setValidation(UpdateRequest::class);

//otherwise, changes won't have effect
\Cache::forget('spatie.permission.cache');
app()->make(PermissionRegistrar::class)->forgetCachedPermissions();
}

private function addFields()
Expand Down
5 changes: 3 additions & 2 deletions src/app/Http/Controllers/RoleCrudController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Backpack\CRUD\app\Http\Controllers\CrudController;
use Backpack\PermissionManager\app\Http\Requests\RoleStoreCrudRequest as StoreRequest;
use Backpack\PermissionManager\app\Http\Requests\RoleUpdateCrudRequest as UpdateRequest;
use Spatie\Permission\PermissionRegistrar;

// VALIDATION

Expand Down Expand Up @@ -104,7 +105,7 @@ public function setupCreateOperation()
$this->crud->setValidation(StoreRequest::class);

//otherwise, changes won't have effect
\Cache::forget('spatie.permission.cache');
app()->make(PermissionRegistrar::class)->forgetCachedPermissions();
}

public function setupUpdateOperation()
Expand All @@ -113,7 +114,7 @@ public function setupUpdateOperation()
$this->crud->setValidation(UpdateRequest::class);

//otherwise, changes won't have effect
\Cache::forget('spatie.permission.cache');
app()->make(PermissionRegistrar::class)->forgetCachedPermissions();
}

private function addFields()
Expand Down

0 comments on commit 4263672

Please sign in to comment.