Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
geisi committed Apr 17, 2024
1 parent 0780dba commit e38f277
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/LaravelPolicySoftCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,15 @@ protected function callPolicyMethod(Model $user, object $policy, string $ability
*/
protected function getCacheKey(Model $user, object $policy, array $args, string $ability): string
{
return get_class($user).'_'.$user->{$user->getKeyName()}.'_'.hash_hmac('sha512', (string) json_encode($args), config('app.key')).'_'.$ability.'_'.$policy::class;
return collect([
//the user class
get_class($user),
//the user id
$user->{$user->getKeyName()},
//hash of the arguments
hash_hmac('sha512', json_encode($args), config('app.key')),

Check failure on line 106 in src/LaravelPolicySoftCache.php

View workflow job for this annotation

GitHub Actions / phpstan

Parameter #2 $data of function hash_hmac expects string, string|false given.
$ability,
get_class($policy),
])->join('_');
}
}

0 comments on commit e38f277

Please sign in to comment.