【发布时间】:2013-03-14 11:20:54
【问题描述】:
我在 Stack 上搜索,看到了这个问题How to add filter parameters to controllers in 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?
【问题讨论】: