public function actionIndex() { $this->layout = '/adminka-admin'; $video_categoria = VideoCategoria::find()->all(); $authors = Author::find()->all(); return $this->render('index', ['video_categoria' => $video_categoria, 'authors' => $authors]); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = VideoCategoria::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if ($this->load($params) && !$this->validate()) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id]); $query->andFilterWhere(['like', 'name', $this->name]); return $dataProvider; }
/** * Finds the VideoCategoria model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return VideoCategoria the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = VideoCategoria::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public static function getModel() { return VideoCategoria::find()->all(); }
?> </a></li> <?php } ?> </ul> </li> <li class="sub-menu <?php if ($url == 'video/view') { echo "active"; } ?> "><a href="javascript:void(0);">Видео</a> <ul> <?php foreach (VideoCategoria::getModel() as $categoria) { ?> <li><a href="<?php echo Url::to(['/video/view', 'categoria_id' => $categoria->id]); ?> "><?php echo $categoria->name; ?> </a></li> <?php } ?> </ul> </li> <li class="sub-menu <?php if ($url == 'video/tv24' || $url == 'video/tv1' || $url == 'video/5canal') {
/** * @return \yii\db\ActiveQuery */ public function getCategoria() { return $this->hasOne(VideoCategoria::className(), ['id' => 'categoria']); }