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

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?



Solution 1:[1]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Karl Hill