예제 #1
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getRecentProducts()
 {
     return $this->hasMany(RecentProduct::className(), ['user_id' => 'id']);
 }
예제 #2
0
 /**
  * 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();
 }