首页 > 解决方案 > 如何制作自定义忘记控制器?

问题描述

在 laravel 中,有 auth::routes,但我不想使用它,而是想制作自己的忘记密码控制器。谁能告诉我该怎么做?

标签: laravelauthenticationmodel-view-controllerforgot-password

解决方案


auth::routes()只是一个包装器,您可以在其中找到方法routes()vendor/laravel/framework/src/Illuminate/Routing/Router.php查看该方法添加的所有路由。所以基本上只需auth::route()使用您自己的控制器删除和添加路由。

这是其中的一些:

$this->get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request');
$this->post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email');
$this->get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset');
$this->post('password/reset', 'Auth\ResetPasswordController@reset')->name('password.update');

路线可能会因您的 Laravel 版本而异。


推荐阅读