1 | <?php |
||
10 | class Access |
||
11 | { |
||
12 | /** |
||
13 | * Get the currently authenticated user or null. |
||
14 | */ |
||
15 | public function user() |
||
19 | |||
20 | /** |
||
21 | * Return if the current session user is a guest or not. |
||
22 | * |
||
23 | * @return mixed |
||
24 | */ |
||
25 | public function guest() |
||
26 | { |
||
27 | return auth()->guest(); |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * @return mixed |
||
32 | */ |
||
33 | public function logout() |
||
34 | { |
||
35 | return auth()->logout(); |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * Get the currently authenticated user's id. |
||
40 | * |
||
41 | * @return mixed |
||
42 | */ |
||
43 | public function id() |
||
47 | |||
48 | /** |
||
49 | * @param Authenticatable $user |
||
50 | * @param bool $remember |
||
51 | */ |
||
52 | public function login(Authenticatable $user, $remember = false) |
||
56 | |||
57 | /** |
||
58 | * @param $id |
||
59 | * |
||
60 | * @return mixed |
||
61 | */ |
||
62 | public function loginUsingId($id) |
||
63 | { |
||
64 | return auth()->loginUsingId($id); |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * Return if the current session user is a logged in. |
||
69 | * |
||
70 | * @return mixed |
||
71 | */ |
||
72 | public function check() |
||
76 | } |
||
77 |
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: