#does each request i'm fed a new User Model object or what's going on?

3 messages · Page 1 of 1 (latest)

icy fossil
#
// App\Models\User.php
    public $role;

    public function hasRole(string $role){
        return $this->role === $role;
    }

    public function assignRole(){
        $this->role=UserRoles::addSelect(['id'=>User::select('user_role_id')
            ->whereColumn('user_role_id','user_roles.id')
            ->limit(1)
        ])->value('title');
        return $this;
    }

#

here it assigns it on login endpoint