In Laravel framework: Documentations (route filter section) says:
You may also specify that a filter applies to an entire set of routes based on their URI.
Route::filter('admin', function() { // }); Route::when('admin/*', 'admin');
What if I have more than one filter and wanted to apply them all on an entire set of routes based on their URI? Should I apply them like this:
Route::when('admin/*', 'filter_1');
Route::when('admin/*', 'filter_2');
Route::when('admin/*', 'filter_3');
Or I can put them all in an array and apply them like this:
Route::when('admin/*', array('filter_1', 'filter_2', 'filter_3'));
After trying I have found that using
Route::when('admin/*', array('filter_1', 'filter_2', 'filter_3'));
will perform the same result, so YES, I can use the above line instead of the next 3 lines
Route::when('admin/*', 'filter_1');
Route::when('admin/*', 'filter_2');
Route::when('admin/*', 'filter_3');
And note that filters will be applied respectively, which means filter_1
will be applied first, and if everything is ok filter_2
will apply and so on.