public function attachRoles($roles)
    {
        if ($roles instanceof Role) {
            $roles = [$roles->getKey()];
        }

        $this->roles()->sync($roles, false);

        unset($this->relations['roles']);

        return $this;
    }
public function attachRoles($roles)
    {
        if ($roles instanceof Role) {
            $roles = [$roles->getKey()];
        }

        $this->roles()->sync($roles, false);

        unset($this->relations['roles']);

        return $this;
    }
public function attachRoles ( $ roles ) { if ( $ roles instanceof Role ) { $ roles = [ $ roles -> getKey ( ) ] ; } $ this -> roles ( ) -> sync ( $ roles , false ) ; unset ( $ this -> relations [ 'roles' ] ) ; return $ this ; }
Assign roles to user.

@param  \Orchestra\Model\Role|int|array  $roles

@return $this
Assign roles to user .