How to add OR for adding multiple gate permissions at construct method of controller

262 views Asked by At

I'm working with Laravel 5.8 and I have created this method in the Controller:

public function __construct()
    {
        $this->middleware('can:see-brand-requests')->only(['index']);
    }

Now I need to say if user has one of these permissions, the show the index method:

brand-owner-info,brand-overall-info,brand-employees-info,brand-actions,see-brand-requests

So how can I add OR in this case to the Middleware?

1

There are 1 answers

0
Peter Amo On

You can do something like the following.

@canany(['show-permissions','show-roles'])

@endcan

Find out more information here: https://laravel.com/docs/9.x/authorization.