jeudi 5 mars 2020

Laravel 5.8 Multiple middlewares using guards and specific options for each guard

I have a laravel application that allows both admins and customers to gain access to it and for each one of them will have specific permissions using 2 separated tables for each type of user to auth and 2 different guards. what I need now is to give customers access specific methods inside the controller and the admin have access to all methods.

class OrdersController extends Controller
{
    public function __construct()
    {
        $this->middleware(['auth:client'])->only(['index', 'create', 'store', 'edit', 'printOrder']);
        $this->middleware('auth:admin');
}

but it works fine for the client and it's not working for the admin



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire