0
我在Stack上搜索並查看這個問題How to add filter parameters to controllers in Laravel?。帶參數的Laravel濾波器
我有一個類似的問題,但這個時候,我需要通過一個靈活的$ myparam的說法,代碼看起來像波紋管:
在Route.php
Route::filter('diffauthor',function($myparam){
if(Authority::cannot('edit', 'postedit', $myparam))
return View::make('permdeny.index');
});
和控制器:
public function __construct() {
parent::__construct();
$this->filter('before','diffauthor', $myparam);
}
如何通過$ myparam基於用戶請求?