Prashant Patil
Prashant Patil

Reputation: 31

Laravel two diffrent middleware authentication from auth middleware only

I have two seprate table for authentication. Following middleware pointing to different table:

$this->middleware('auth:admin'); // - admins 
$this->middleware('auth'); // - user

The solution i need :

For this, in which file and where I need to change in my project folder?

Upvotes: 1

Views: 285

Answers (1)

lagbox
lagbox

Reputation: 50481

If you want to have both "guards" be checked you can just pass multiple guards to the auth middleware.

$this->middleware('auth:web,admin');

This will spin through the guards passed and if any of them produce a user it will set that guard as the default moving forward.

Upvotes: 1

Related Questions