Created
November 11, 2013 11:12
-
-
Save ihsanberahim/7411664 to your computer and use it in GitHub Desktop.
Laravel 4 Route group filtering From http://paste.laravel.com/16ya
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
<?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