Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 11
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
PasswordResetLinkController
0.00% covered (danger)
0.00%
0 / 11
0.00% covered (danger)
0.00%
0 / 2
12
0.00% covered (danger)
0.00%
0 / 1
 create
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 store
0.00% covered (danger)
0.00%
0 / 10
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2
3namespace App\Http\Controllers\Auth;
4
5use App\Http\Controllers\Controller;
6use Illuminate\Http\RedirectResponse;
7use Illuminate\Http\Request;
8use Illuminate\Support\Facades\Password;
9use Illuminate\View\View;
10
11class PasswordResetLinkController extends Controller
12{
13    /**
14     * Display the password reset link request view.
15     */
16    public function create(): View
17    {
18        return view('auth.forgot-password');
19    }
20
21    /**
22     * Handle an incoming password reset link request.
23     *
24     * @throws \Illuminate\Validation\ValidationException
25     */
26    public function store(Request $request): RedirectResponse
27    {
28        $request->validate([
29            'email' => ['required', 'email'],
30        ]);
31
32        // We will send the password reset link to this user. Once we have attempted
33        // to send the link, we will examine the response then see the message we
34        // need to show to the user. Finally, we'll send out a proper response.
35        $status = Password::sendResetLink(
36            $request->only('email')
37        );
38
39        return $status == Password::RESET_LINK_SENT
40                    ? back()->with('status', __($status))
41                    : back()->withInput($request->only('email'))
42                        ->withErrors(['email' => __($status)]);
43    }
44}