Conditions | 3 |
Paths | 2 |
Total Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
13 | public function __invoke(IssueTokenRequest $request) |
||
14 | { |
||
15 | /** @var \Oscer\Cms\Core\Users\Models\User $user */ |
||
16 | $user = User::query()->where('email', $request->input('email'))->first(); |
||
17 | |||
18 | if (! $user || ! Hash::check($request->input('password'), $user->getAuthPassword())) { |
||
19 | throw new HttpResponseException(response()->json([ |
||
|
|||
20 | 'errors' => [ |
||
21 | 'email' => ['The provided credentials are incorrect.'], |
||
22 | ], |
||
23 | ], JsonResponse::HTTP_UNPROCESSABLE_ENTITY)); |
||
24 | } |
||
25 | |||
26 | return response()->json(['token' => $user->createToken('admin_ui')->plainTextToken], 201); |
||
27 | } |
||
28 | } |
||
29 |
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: