Skip to content

Commit

Permalink
fix: Crud permissions for non-model based check. (ie create)
Browse files Browse the repository at this point in the history
  • Loading branch information
craigAtCD committed Jul 21, 2021
1 parent 26d9c19 commit 49138db
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Models/Policies/CrudPermissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function can(Authenticatable $user, string $action, ?Model $model = null)
$action
])->filter()->implode(".");

if (method_exists($model, 'userHasPermission') && ! $model->userHasPermission($user)) {
if ($model && method_exists($model, 'userHasPermission') && ! $model->userHasPermission($user)) {
return false;
}

Expand Down

0 comments on commit 49138db

Please sign in to comment.