| Conditions | 3 |
| Paths | 3 |
| Total Lines | 12 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | public function handle($request, Closure $next, $guard = null) |
||
| 36 | { |
||
| 37 | if ($this->auth->guard($guard)->guest()) { |
||
| 38 | return response()->json(['message' => 'authentication-needed'], 401); |
||
|
|
|||
| 39 | } |
||
| 40 | |||
| 41 | if ($request->user()->isBanned == true) { |
||
| 42 | return response('Unauthorized.', 401); |
||
| 43 | } |
||
| 44 | |||
| 45 | return $next($request); |
||
| 46 | } |
||
| 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: