laravel 5.3新添加了Auth::routes()。

13 浏览
0 Comments

laravel 5.3新添加了Auth::routes()。

最近我开始使用laravel 5.3写博客,但是在运行php artisan make:auth之后有一个问题。

当我运行它时,它会生成我的web.php中的路线。

这是它里面的代码:

Auth::routes();
Route::get('/home', 'HomeController@index');

然后我运行php artisan route:list,我发现有很多动作,比如LoginController@login……

但是我在App\\Http\\Controllers\\Auth中没找到这些动作,他们在哪里?

还有,Auth::routes()是什么意思,我找不到有关Auth的路由。

我需要有人帮助,谢谢您回答我的问题。

admin 更改状态以发布 2023年5月21日
0
0 Comments

这里是Laravel 5.7Laravel 5.8Laravel 6.0Laravel 7.0Laravel 8.0(请注意6.0中电子邮件验证路由的小变化)。

// Authentication Routes...
Route::get('login', 'Auth\LoginController@showLoginForm')->name('login');
Route::post('login', 'Auth\LoginController@login');
Route::post('logout', 'Auth\LoginController@logout')->name('logout');
// Registration Routes...
Route::get('register', 'Auth\RegisterController@showRegistrationForm')->name('register');
Route::post('register', 'Auth\RegisterController@register');
// Password Reset Routes...
Route::get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request');
Route::post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email');
Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset');
Route::post('password/reset', 'Auth\ResetPasswordController@reset')->name('password.update');
// Confirm Password (added in v6.2)
Route::get('password/confirm', 'Auth\ConfirmPasswordController@showConfirmForm')->name('password.confirm');
Route::post('password/confirm', 'Auth\ConfirmPasswordController@confirm');
// Email Verification Routes...
Route::get('email/verify', 'Auth\VerificationController@show')->name('verification.notice');
Route::get('email/verify/{id}/{hash}', 'Auth\VerificationController@verify')->name('verification.verify'); // v6.x
/* Route::get('email/verify/{id}', 'Auth\VerificationController@verify')->name('verification.verify'); // v5.x */
Route::get('email/resend', 'Auth\VerificationController@resend')->name('verification.resend');

您可以在此验证这些路由:

0
0 Comments

Auth::routes() 是一个帮助类,可以帮助你生成用户身份验证所需的所有路由。你可以在此处浏览代码。 https://github.com/laravel/framework/blob/5.3/src/Illuminate/Routing/Router.php

以下是路由:

// Authentication Routes...
$this->get('login', 'Auth\LoginController@showLoginForm')->name('login');
$this->post('login', 'Auth\LoginController@login');
$this->post('logout', 'Auth\LoginController@logout')->name('logout');
// Registration Routes...
$this->get('register', 'Auth\RegisterController@showRegistrationForm')->name('register');
$this->post('register', 'Auth\RegisterController@register');
// Password Reset Routes...
$this->get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm');
$this->post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail');
$this->get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm');
$this->post('password/reset', 'Auth\ResetPasswordController@reset');

0