laravel - 如何制作自定义忘记控制器?
问题描述
在 laravel 中,有 auth::routes,但我不想使用它,而是想制作自己的忘记密码控制器。谁能告诉我该怎么做?
解决方案
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 版本而异。
推荐阅读
- excel - 比较两个列表 - VBA
- c++ - Cpp 中的动态函数
- java - GUI 编程(续) - NullPointer 异常作为猜数字游戏的输出
- php - 使用 javascript 通过 GET 传递链接
- android - 如何在 Flutter 中更改权限对话框 UI?
- java - 龙目岛@SneakyThrows 表现
- javascript - 不变性不是以速度为代价的吗?
- subdomain - 如何将域定向到子域(Next.js + ZEIT)
- system-verilog - 有人可以解释这种奇怪的 systemverilog 约束行为吗?
- c# - .Net - Linq to SQL - 行级租赁