| Conditions | 2 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | public function __invoke() |
||
| 12 | { |
||
| 13 | if (Auth::attempt([ |
||
| 14 | 'email' => request('email'), |
||
| 15 | 'password' => request('password'), |
||
| 16 | ])) { |
||
| 17 | return new UserResource(auth()->user()); |
||
| 18 | } |
||
| 19 | |||
| 20 | return response()->json([ |
||
| 21 | 'message' => 'invalid credentials or such user doesn\'t exist', |
||
| 22 | 'error' => 'Unprocessable Entity (validation failed)', |
||
| 23 | ], 422); |
||
| 24 | } |
||
| 26 |