在laravel中,當滿足某一個url進而使用filter時,你可以這樣使用:
1 2 3 4 5 6 7 8 9 10 11 |
$str_birthday = '02-09'; Route::filter('chk_birthday', function($route, $request, $date) { if (date('mm-dd') == $date) { return "Today not my birthday"; } else { return "Today is my birthday!!!"; } }); { Route::when( 'my_birthday', array('before' => 'chk_birthday:'.$str_birthday)); |
改寫來源參考文章:
http://daylerees.com/codebright/filters
1946 全部 1 今日