Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 5.2 Auth and Password route

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\AuthController@showLoginForm');
[...]

// Registration Routes...
Route::get('register', 'Auth\AuthController@showRegistrationForm');
[...]

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

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 !

like image 430
Jiedara Avatar asked Dec 29 '15 16:12

Jiedara


3 Answers

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.

like image 98
Bogdan Avatar answered Oct 17 '22 04:10

Bogdan


vendor/laravel/framework/src/Illuminate/Routing/Router.php
go for this file auth method, there all routes defined

like image 44
palash140 Avatar answered Oct 17 '22 02:10

palash140


May This Code Help You..

Route::get('auth/login', 'Auth\AuthController@getLogin');
Route::post('auth/login', 'Auth\AuthController@postLogin');
Route::get('auth/logout', 'Auth\AuthController@getLogout');
Route::get('auth/confirm/{token}', 'Auth\AuthController@getConfirm');

For Password

  Route::get('password/email', 'Auth\PasswordController@getEmail');
  Route::post('password/email', 'Auth\PasswordController@postEmail');


  Route::get('password/reset{token}','Auth\PasswordController@getReset');
  Route::post('password/reset', 'Auth\PasswordController@postReset');
like image 2
Yagnik Detroja Avatar answered Oct 17 '22 03:10

Yagnik Detroja