src/Traits/HasRoles.php
public function assignRole($role)
    {
        if (is_string($role)) {
            return $this->roles()->attach(Role::where('slug', $role)->first());
        }

        return $this->roles()->attach($role);
    }
public function assignRole($role)
    {
        if (is_string($role)) {
            return $this->roles()->attach(Role::where('slug', $role)->first());
        }

        return $this->roles()->attach($role);
    }
Assign a role to this user

@param string|Role $role
@return boolean