コード例 #1
0
 public function actionDeleteBm($advert_id)
 {
     Bookmark::findOne(['advert_id' => $advert_id, 'user_id' => Yii::$app->user->identity->getId()])->delete();
     return $this->redirect(['my-bookmarks']);
 }
コード例 #2
0
 /**
  * Finds the Bookmark model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Bookmark the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Bookmark::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }