Ad

Laravel 5.2 Auth And Password Route

- 1 answer

I saw that Laravel 5.2 change the routes.php use.

In fact, the old :

Route::controllers([
'auth' => 'Auth\AuthController',
'password' => 'Auth\PasswordController',
]);

don't work now.

Instead I saw it was better to use :

Route::Auth();

But this method don't provide password and register route like it use to...

Actually, I use a solution I saw on Stack Overflow, using get and post method :

// Authentication Routes...
Route::get('login', 'Auth\[email protected]');
[...]

// Registration Routes...
Route::get('register', 'Auth\[email protected]');
[...]

// Password Reset Routes...
Route::get('password/reset/{token?}','Auth\[email protected]');
[...]

It's quite awful, so is there a better usage of the 5.2 route.php file for this new Laravel version ?

Thanks for your help !

Ad

Answer

Since Laravel 5.2, the authentication system is much easier to get up and running. You can simply run this command:

php artisan make:auth

That will take care of setting up the necessary authentication resources: route definitions, views, etc. There's more info on the subject in the Laravel Documentation. You can also check out this article to see other features that are new to Laravel 5.2.

Ad
source: stackoverflow.com
Ad