what does $guard in Admin or User do?

Posted 2 months ago by michaelnguyen547

I am reading some multi auth tutorial and most of them add protected $guard = 'admin' to Admin class. I can not find anything in Laravel documentation about this protected $guard.

namespace App\Models;
use Illuminate\Foundation\Auth\User as Authenticatable;
class Admins extends Authenticatable
{
    
    protected $guard = 'admin';
    ......
}

anybody know about thing about this $guard ?

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.