| Conditions | 2 |
| Paths | 2 |
| Total Lines | 20 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | public function store(Request $request): JsonResponse |
||
| 19 | { |
||
| 20 | $request->validate([ |
||
| 21 | 'email' => ['required', 'email'], |
||
| 22 | ]); |
||
| 23 | |||
| 24 | // We will send the password reset link to this user. Once we have attempted |
||
| 25 | // to send the link, we will examine the response then see the message we |
||
| 26 | // need to show to the user. Finally, we'll send out a proper response. |
||
| 27 | $status = Password::broker('admins')->sendResetLink( |
||
| 28 | $request->only('email') |
||
| 29 | ); |
||
| 30 | |||
| 31 | if ($status != Password::RESET_LINK_SENT) { |
||
| 32 | throw ValidationException::withMessages([ |
||
| 33 | 'email' => [__($status)], |
||
| 34 | ]); |
||
| 35 | } |
||
| 36 | |||
| 37 | return response()->json(['status' => __($status)]); |
||
| 38 | } |
||
| 40 |