我在我的laravel项目中有这个,我想在exept数组中添加更多方法。我无法弄清楚我应该怎么写它?
public function __construct()
{
$this->middleware('auth', [ 'except' => 'index' ]);
}
答案 0 :(得分:2)
只需添加如下数组:
public function __construct()
{
$this->middleware('auth', [ 'except' =>['index','fooAction'] ]);
}
您可以在此处查看更多相关信息:https://laravel.com/docs/5.1/controllers#controller-middleware
答案 1 :(得分:1)
试试这个
public function __construct()
{
$this->middleware('auth', [ 'except' => ['index','home'] ]);
}