While using permission middleware it throws error #1953
yasirmehmood123
started this conversation in
General
Replies: 1 comment 2 replies
-
laravel-permission/src/Traits/HasPermissions.php Lines 45 to 53 in 08cc9bd Also can is tested GateTest |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I was trying to use the permissions for a role and everything was added as per documentation like adding middleware in kernel.php
let me give an example how I am using it
Route::group(['middleware' => ['can:view customers']], function () {
Let me show the error as well
Call to a member function contains() on array
File directory where I found it
"\vendor\spatie\laravel-permission\src\Traits\HasPermissions.php:288"
I fixed it by replacing line number 288 of HasPermission trait let me show an example of this as well
return $this->permissions->contains($permission->getKeyName(), $permission->getKey());
to
return collect($this->permissions)->contains($permission->getKeyName(), $permission->getKey());
please if i am wrong correct me but if this is a real issue than please update it in the coming updates
Beta Was this translation helpful? Give feedback.
All reactions