예제 #1
0
 protected function findModel($id)
 {
     if (($model = Blog::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
예제 #2
0
 /**
  * Deletes an existing Blog model.
  * If deletion is successful, the browser will be redirected to the 'index' page.
  * @param integer $id
  * @return mixed
  */
 public function actionDelete($id)
 {
     $model = Blog::findOne($id);
     if ($model) {
         $model->delete();
     }
     return $this->redirect(['index']);
 }
예제 #3
0
 public function actionBlogDetail($id)
 {
     $data = $this->getCommonDate();
     $modelGoodsCategories = GoodsCategory::find()->all();
     $modelBanner = Banner::find()->where(['status' => 0])->all();
     $modelBrends = Brend::find()->all();
     $modelBlog = Blog::findOne($id);
     $modelBlogComents = BlogComments::getComentsByBlogId($id);
     return $this->render('blog-detail', ['modelBlog' => $modelBlog, 'data' => $data, 'modelGoodsCategories' => $modelGoodsCategories, 'modelBrends' => $modelBrends, 'modelBanner' => $modelBanner, 'modelBlogComents' => $modelBlogComents]);
 }