Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 12
ForgotPasswordControllerCustom
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 3
30.00
0.00% covered (danger)
0.00%
0 / 12
 __construct
0.00% covered (danger)
0.00%
0 / 1
2.00
0.00% covered (danger)
0.00%
0 / 2
 sendResetLinkEmail
0.00% covered (danger)
0.00%
0 / 1
12.00
0.00% covered (danger)
0.00%
0 / 8
 resetNotifier
0.00% covered (danger)
0.00%
0 / 1
2.00
0.00% covered (danger)
0.00%
0 / 2
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Auth;
use Illuminate\Support\Facades\Password;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
class ForgotPasswordControllerCustom extends Controller
{
    /*
    |--------------------------------------------------------------------------
    | Password Reset Controller
    |--------------------------------------------------------------------------
    |
    | This controller is responsible for handling password reset emails and
    | includes a trait which assists in sending these notifications from
    | your application to your users. Feel free to explore this trait.
    |
    */
    use SendsPasswordResetEmails;
    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('guest');
    }
    /**
      * sends an email to reset the password
      * @param Request $request
      * @return redirect to home
      */
    public function sendResetLinkEmail(Request $request)
    {
        $this->validate($request, ['email' => 'required|email']);
        $response = $this->broker()->sendResetLink(
            $request->only('email'),
            $this->resetNotifier()
        );
        switch ($response) {
            case Password::RESET_LINK_SENT:
                return "A password reset link was sent to your e-mail. Don't forget to check the spam folder.";
            case Password::INVALID_USER:
            default:
                return redirect()->route('home')->withErrors("That user e-mail was not found.");
        }
    }
    /**
      * Resets the notifier
      */
    protected function resetNotifier()
    {
        return function ($token) {
            new ResetPasswordNotification($token);
        };
    }
}