예제 #1
0
 public function actionDeletePhoto($id)
 {
     $photo = Photos::findOne($id);
     $photo->delete();
     return $this->redirect(Yii::$app->request->referrer);
 }
예제 #2
0
 /**
  * Finds the Photos model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Posts the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModelPhoto($id)
 {
     if (($model = Photos::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }