Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 5.2: where are auth routes declared?

I need to rearrange the urls used by the auth system. Laravel 5.2. I used artisan make:auth and now I can't locate where the router is told what to do with /login and /logout. IMHO, it seems to me a step backwards in the 'ease of use' Laravel strives for that so many commonly overridden features should hav ebecome so obscured in recent revisions.

I'm dividing up the app into admin and public areas and there are to be separate login mechanisms for each: /admin/login is to be handled by the core Laravel system, and /login will be for frontside admin users, auth handled by a different set of classes.

Can someone clue me in please?

like image 275
RSAdmin Avatar asked Feb 07 '23 18:02

RSAdmin


1 Answers

php artisan make:auth adds the following line to your routes file:

Route::group(['middleware' => 'web'], function () {
    Route::auth();
}

Route::auth() is a shortcut to defining the following routes:

// Authentication Routes...
$this->get('login', 'Auth\AuthController@showLoginForm');
$this->post('login', 'Auth\AuthController@login');
$this->get('logout', 'Auth\AuthController@logout');

// Registration Routes...
$this->get('register', 'Auth\AuthController@showRegistrationForm');
$this->post('register', 'Auth\AuthController@register');

// Password Reset Routes...
$this->get('password/reset/{token?}', 'Auth\PasswordController@showResetForm');
$this->post('password/email', 'Auth\PasswordController@sendResetLinkEmail');
$this->post('password/reset', 'Auth\PasswordController@reset');

So assuming you ran auth:make and haven't touched anything, those will be the routes you can use.

Source: https://mattstauffer.co/blog/the-auth-scaffold-in-laravel-5-2#routeauth

like image 103
Jeff Avatar answered Feb 10 '23 10:02

Jeff