Exemplo n.º 1
0
 protected function findModel($id)
 {
     if (($model = Content::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemplo n.º 2
0
 public function actionIndex($id)
 {
     Content::updateAllCounters(['views' => 1], ['id' => $id]);
     $model = Content::findOne(['id' => $id]);
     return $this->render('index', ['model' => $model]);
 }