assign separate middleware to each method of a resource in laravel

前端 未结 1 816
天涯浪人
天涯浪人 2021-01-24 02:05

I am using Zizaco/entrust laravel package as a ACL Manager for my project.

I know that for limit access to a route group via middlewares and assign a role (or permissio

相关标签:
1条回答
  • 2021-01-24 02:48

    You can assign middlewares in your controller's constructor:

    class Foo extends Conroller
    {
        public function __construct() {
    
            $this->middleware('post-create', ['only' => ['create']]);
    
            $this->middleware('post-edit', ['only' => ['edit']]);
        }
    }
    
    0 讨论(0)
提交回复
热议问题