mercredi 24 février 2016

Route pattern based middleware

I want to apply an array of middlewares to the routes matching a specific pattern. In Laravel 4, doing Route::when('admin*', array('auth', 'admin_auth')); would apply the auth and admin_auth filters to routes starting with the text admin. What would I need to do in order to achieve the same in Laravel 5.1 with Middlewares?

I have done this by using Route groups, but I need to do this without using route groups as in my project there can be multiple route files and it wouldn't be possible to add route groups in every route file along with middlewares.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire