Skip to content
This repository has been archived by the owner on May 19, 2020. It is now read-only.

Commit

Permalink
Fix getting cache tags from user model not ShinobiTrait (#66) (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Sooley authored and kaidesu committed Nov 16, 2017
1 parent 41cd0ae commit 6be6885
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
12 changes: 8 additions & 4 deletions src/Models/Role.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

class Role extends Model
{
use PermissionTrait;
use PermissionTrait {
flushPermissionCache as parentFlushPermissionCache;
}

/**
* The attributes that are fillable via mass assignment.
Expand All @@ -29,7 +31,7 @@ class Role extends Model
*
* @return string
*/
protected static function getShinobiTag()
public static function getShinobiTag()
{
return 'shinobi.roles';
}
Expand Down Expand Up @@ -61,9 +63,11 @@ protected function getFreshPermissions()
*/
public function flushPermissionCache()
{
parent::flushPermissionCache([
$userClass = config('auth.model') ?: config('auth.providers.users.model');
$usersTag = call_user_func([$userClass, 'getShinobiTag']);
static::parentFlushPermissionCache([
static::getShinobiTag(),
\Caffeinated\Shinobi\Traits\ShinobiTrait::getShinobiTag()
$usersTag,
]);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Traits/PermissionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ trait PermissionTrait
*
* @return string
*/
protected static function getShinobiTag()
public static function getShinobiTag()
{
return '';
}
Expand Down
2 changes: 1 addition & 1 deletion src/Traits/ShinobiTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ trait ShinobiTrait
*
* @return string
*/
protected static function getShinobiTag()
public static function getShinobiTag()
{
return 'shinobi.users';
}
Expand Down

0 comments on commit 6be6885

Please sign in to comment.