public function syncRoles($roles, $detach = false)
    {
        foreach ($roles as $k => $slug) {
            // add dealer role to user
            $role = Role::where('keyword', $slug)->first();
            $this->roles()->syncWithoutDetaching([$role->id]);
        }

        return $this->roles;
    }
public function syncRoles($roles, $detach = false)
    {
        foreach ($roles as $k => $slug) {
            // add dealer role to user
            $role = Role::where('keyword', $slug)->first();
            $this->roles()->syncWithoutDetaching([$role->id]);
        }

        return $this->roles;
    }
public function syncRoles ( $ roles , $ detach = false ) { foreach ( $ roles as $ k => $ slug ) { // add dealer role to user $ role = Role :: where ( 'keyword' , $ slug ) -> first ( ) ; $ this -> roles ( ) -> syncWithoutDetaching ( [ $ role -> id ] ) ; } return $ this -> roles ; }
Sync the roles
@param      $roles
@param bool $detach
@return mixed
Sync the roles