Skip to content

Instantly share code, notes, and snippets.

@ihsanberahim
Created November 11, 2013 11:12
Show Gist options
  • Save ihsanberahim/7411664 to your computer and use it in GitHub Desktop.
Save ihsanberahim/7411664 to your computer and use it in GitHub Desktop.
Laravel 4 Route group filtering From http://paste.laravel.com/16ya
<?php
//Not work
Route::filter('test', function()
{
die('test filtered');
});
Route::when('test/*', 'test');
Route::get('test',function(){
return 'test';
});
Route::get('test/a',function(){
return 'test A';
});
Route::get('test/b',function(){
return 'test B';
});
//Work
Route::filter('testFilter', function()
{
die('test filtered');
});
Route::group(array('before'=>'testFilter','prefix' => 'test'),function(){
Route::get('/',function(){
return 'test';
});
Route::get('/a',function(){
return 'test A';
});
Route::get('/b',function(){
return 'test B';
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment