Я новичок в laravel и пытаюсь внедрить забываемый пароль в моем проекте. Я получаю электронное письмо с забытым паролем, но когда я нажимаю на него, отображается сообщение об ошибке object not found
. Ниже приведен мой код в маршрутах
Route::get('user/password/reset', 'User\UserAuth\ForgotPasswordController@showLinkRequestForm')->name('password.reset');
Route::post('user/password/email', 'User\UserAuth\ForgotPasswordController@sendResetLinkEmail')->name('password.reequest');
Route::post('user/password/reset', 'User\UserAuth\ResetPassswordController@reset')->name('password.email');
Route::get('/password/reset/{token?}', 'User\UserAuth\ResetPasswordController@showResetForm');
Ниже приведен код в ForgetPasswordController
<?php
namespace App\Http\Controllers\User\UserAuth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
use Illuminate\Support\Facades\Password;
use JsValidator;
class ForgotPasswordController 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;
protected $validationRules = [
'email' => 'required|email',
];
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
}
/**
* Display the form to request a password reset link.
*
* @return \Illuminate\Http\Response
*/
public function showLinkRequestForm()
{
$validator = JsValidator::make($this->validationRules,[],[],'#forgotform');
return view('user.auth.passwords.email')->with(['validator' => $validator]);
}
/**
* Get the broker to be used during password reset.
*
* @return \Illuminate\Contracts\Auth\PasswordBroker
*/
public function broker()
{
return Password::broker('users');
}
}
Ниже приведен код в ResetPaawordcontroller
namespace App\Http\Controllers\User\UserAuth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ResetsPasswords;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Password;
use Illuminate\Http\Request;
use JsValidator;
class ResetPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/
use ResetsPasswords;
/**
* Where to redirect users after login / registration.
*
* @var string
*/
public $redirectTo = '/user/home';
protected $validationRules = [
'name' => 'required|max:255',
'email' => 'required|email|max:255',
'password' => 'required|min:6|confirmed',
];
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('user.guest');
}
/**
* Display the password reset view for the given token.
*
* If no token is present, display the link request form.
*
* @param \Illuminate\Http\Request $request
* @param string|null $token
* @return \Illuminate\Http\Response
*/
public function showResetForm(Request $request, $token = null)
{
echo "hi";
die();
$validator = JsValidator::make($this->validationRules,[],[],'#resetform');
return view('user.auth.passwords.reset')->with(
['token' => $token, 'email' => $request->email, 'validator' => $validator]
);
}
/**
* Get the broker to be used during password reset.
*
* @return \Illuminate\Contracts\Auth\PasswordBroker
*/
public function broker()
{
return Password::broker('users');
}
/**
* Get the guard to be used during password reset.
*
* @return \Illuminate\Contracts\Auth\StatefulGuard
*/
protected function guard()
{
return Auth::guard('user');
}
}
Когда я нажал кнопку Reset Password
, форма сброса пароля не отображается, показывает объект не найден ошибка
В чем здесь проблема?
Я загрузил свой скриншот ошибки