Last active
August 29, 2015 14:22
-
-
Save adamtomat/d97b105679f051c631dc to your computer and use it in GitHub Desktop.
Naming default implicit auth & password controller routes in Laravel 5.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// By default, Laravel sets up the routes for auth/ and password/ using implicit controllers | |
Route::controllers([ | |
'auth' => 'Auth\AuthController', | |
'password' => 'Auth\PasswordController', | |
]); | |
// This means to get a url to the route, you need to do something like url('/auth/login') | |
// I prefer using named routes and getting the route url like so: route('auth.login') | |
// I also prefer being declarative with my routes | |
// So, I've given each route its own name: | |
Route::controller('auth', 'Auth\AuthController', [ | |
'getRegister' => 'auth.register', | |
'postRegister' => 'auth.register.store', | |
'getLogin' => 'auth.login', | |
'postLogin' => 'auth.login.store', | |
'getLogout' => 'auth.logout' | |
]); | |
Route::controller('password', 'Auth\PasswordController', [ | |
'getEmail' => 'password.email', | |
'postEmail' => 'password.email.store', | |
'getReset' => 'password.reset', | |
'postReset' => 'password.reset.store' | |
]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment