app\HasRoles::assignRole PHP Method

assignRole() public method

Assign the given role to the user.
public assignRole ( string $role ) : mixed
$role string
return mixed
    public function assignRole($role)
    {
        return $this->roles()->save(Role::whereName($role)->firstOrFail());
    }