src/Traits/Favoriteable.php
/**
     * Toggle the favorite status from this Object
     * 
     * @param  int $user_id  [if  null its added to the auth user]
     */
Toggle the favorite status from this Object

@param  int $user_id  [if  null its added to the auth user]
Toggle the favorite status from this Object @param int $user_id [ if null its added to the auth user ]
public function toggleFavorite($user_id = null)
    {
        if ($this->isFavorited($user_id)) {
            $this->removeFavorite($user_id);
            return false;
        } else {
            $this->addFavorite($user_id);
            return true;
        }
    }
public function toggleFavorite ( $ user_id = null ) { if ( $ this -> isFavorited ( $ user_id ) ) { $ this -> removeFavorite ( $ user_id ) ; return false ; } else { $ this -> addFavorite ( $ user_id ) ; return true ; } }
Toggle the favorite status from this Object
Toggle the favorite status from this Object