laravel

Laravel New Auth::routes()

Problem

I needed to generate new Auth routes.

This is what I used so far.

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

Here is the weird thing, I run php artisan route:list, and I am seeing many actions, like LoginController@login...

However I didn’t find these actions in my App\Http\Controllers\Auth, where are these?

Also, what does the Auth::routes() stand for? I can’t find the routes about Auth.

I need someone help, thank you to answer my question

Solution

Auth::routes() is just a helper class that helps you generate all the routes required for user authentication. You can browse the code here https://github.com/laravel/framework/blob/5.8/src/Illuminate/Routing/Router.php instead.

Here are the routes

// 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');

About the author

Avatar

laravelrecipies