public function isFavorite()
    {
        $favoriteProduct = FavoriteProduct::find()
            ->where(['product_id' => $this->id, 'user_id' => \Yii::$app->user->id])->one();
        if (!empty($favoriteProduct)) return true;
        else return false;
    }
public function isFavorite()
    {
        $favoriteProduct = FavoriteProduct::find()
            ->where(['product_id' => $this->id, 'user_id' => \Yii::$app->user->id])->one();
        if (!empty($favoriteProduct)) return true;
        else return false;
    }
public function isFavorite ( ) { $ favoriteProduct = FavoriteProduct :: find ( ) -> where ( [ 'product_id' => $ this -> id , 'user_id' => \ Yii :: $ app -> user -> id ] ) -> one ( ) ; if ( ! empty ( $ favoriteProduct ) ) return true ; else return false ; }
Return true if product has added to favorites already or false if not.
@return boolean
Return true if product has added to favorites already or false if not .