1 | <?php |
||
9 | trait HasRole |
||
10 | { |
||
11 | use InteractsWithRole; |
||
12 | |||
13 | /** |
||
14 | * Check if user have access using any of the acl (permissions or roles slug). |
||
15 | * |
||
16 | * @param string|array $acl |
||
17 | * @return boolean |
||
18 | */ |
||
19 | public function canAccess($acl): bool |
||
23 | |||
24 | /** |
||
25 | * Check if user has at least one of the given permissions |
||
26 | * |
||
27 | * @param string|array $permissions |
||
28 | * @return bool |
||
29 | */ |
||
30 | public function canAtLeast($permissions): bool |
||
53 | |||
54 | |||
55 | /** |
||
56 | * Get all user role permissions. |
||
57 | * |
||
58 | * @return array |
||
59 | */ |
||
60 | public function getPermissions(): array |
||
70 | |||
71 | /** |
||
72 | * Check if the given entity/model is owned by the user. |
||
73 | * |
||
74 | * @param \Illuminate\Database\Eloquent\Model $entity |
||
75 | * @param string $relation |
||
76 | * @return bool |
||
77 | */ |
||
78 | public function owns(Model $entity, $relation = 'user_id'): bool |
||
82 | } |
||
83 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: