小智 5
在控制器的构造函数中,执行以下操作:
public function __construct()
{
//This will apply to every method inside the controller
$this->middleware('auth');
//This will apply only to the methods listed inside the array
$this->middleware('log', ['only' => ['fooAction', 'barAction']]);
//This will apply only to the methods except the ones listed inside the array
$this->middleware('subscribed', ['except' => ['fooAction', 'barAction']]);
}
Run Code Online (Sandbox Code Playgroud)
你可以在这里阅读
| 归档时间: |
|
| 查看次数: |
1681 次 |
| 最近记录: |