Stackers! I'm currently learning laravel5 and I love it, but I'm struggling with one thing. Since Laravel 5 we have Middleware which we can use in controller's construct function, like this:
控制器文件:
public function __construct()
{
$this->middleware('admin', ['only' => 'create']);
}
Now what I want is to define HERE^ (not in routes file) middleware to be used in multiple views, like 'create', 'edit' and 'show'. defining
public function __construct()
{
$this->middleware('admin', ['only' => 'create|edit|show']);
}
不幸的是,这不起作用.我宁愿不使用路由.有什么 idea 吗,亲爱的朋友?