1 | <?php |
||
8 | class Authenticate |
||
9 | { |
||
10 | /** |
||
11 | * The authentication guard factory instance. |
||
12 | * |
||
13 | * @var \Illuminate\Contracts\Auth\Factory |
||
14 | */ |
||
15 | protected $auth; |
||
16 | |||
17 | /** |
||
18 | * Create a new middleware instance. |
||
19 | * |
||
20 | * @param \Illuminate\Contracts\Auth\Factory $auth |
||
21 | */ |
||
22 | public function __construct(Auth $auth) |
||
26 | |||
27 | /** |
||
28 | * Handle an incoming request. |
||
29 | * |
||
30 | * @param \Illuminate\Http\Request $request |
||
31 | * @param \Closure $next |
||
32 | * @param string|null $guard |
||
33 | * @return mixed |
||
34 | */ |
||
35 | public function handle($request, Closure $next, $guard = null) |
||
47 | } |
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: