Esempio n. 1
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getRecentProducts()
 {
     return $this->hasMany(RecentProduct::className(), ['user_id' => 'id']);
 }
 /**
  * Is product already be watched
  * @param Product $product
  * @return bool
  */
 protected function isWatched(Product $product)
 {
     return RecentProduct::find()->where(['user_id' => $this->user->id, 'product_id' => $product->id])->exists();
 }