不仅仅是一种在laravel上验证中间件的方法

时间:2016-01-30 15:38:11

标签: php laravel-5 middleware

我在我的laravel项目中有这个,我想在exept数组中添加更多方法。我无法弄清楚我应该怎么写它?

public function __construct()
    {
    $this->middleware('auth', [ 'except' => 'index' ]);

    }

2 个答案:

答案 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'] ]);

}