mardi 31 mai 2016

Overriding routes set by packages (Laravel 5.2)

I'm using laravel 5.2 with the sentinel package (rydurham/Sentinel).
This package sets some routes automatically, namely:

Route::get('login', ['as' => 'sentinel.login', 'uses' => 'SessionController@create']);
Route::get('logout', ['as' => 'sentinel.logout', 'uses' => 'SessionController@destroy']);
Route::get('sessions/create', ['as' => 'sentinel.session.create', 'uses' => 'SessionController@create']);
Route::post('sessions/store', ['as' => 'sentinel.session.store', 'uses' => 'SessionController@store']);

In order to add my custom logic, I created a new session controller, and attempted to override the routes doing the following:

Route::get('login', ['as' => 'sentinel.login', 'uses' => 'AuthController@create']);
Route::get('sessions/create', ['as' => 'sentinel.session.create', 'uses' => 'AuthController@create']);
Route::post('sessions/store', ['as' => 'sentinel.session.store', 'uses' => 'AuthController@store']);

The problem laravel's routing seemingly favours the package routes. I could comment out the routes in the package, however this would make updating a pain.
How can I override the routes without modifying the package? Thanks!



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1Xen4e3
via IFTTT

Aucun commentaire:

Enregistrer un commentaire