public function actionIndex($title) { $model = Document::find()->where(['title' => $title])->one(); if (is_null($model)) { throw new \yii\web\HttpException(404, Yii::t('burivuh', 'The document does not exist')); } $list = History::find()->select('document_history_id, document_id, created_at, user_id, title, diff')->where(['document_id' => $model->document_id])->orderBy('created_at DESC')->all(); return $this->render('history', ['model' => $model, 'list' => $list]); }
public function actionIndex($category_id = null) { if (is_null($category_id)) { $category = new Home(); } else { $category = Category::findOne($category_id); } if ($category->category_id != 0 && is_null($category)) { throw new \yii\web\HttpException(404, Yii::t('burivuh', 'The category does not exist')); } $categories = Category::find()->where(['parent_id' => $category->category_id])->orderBy('title')->all(); $documents = Document::find()->where(['category_id' => $category->category_id])->orderBy('title')->all(); $readme = Document::find()->where(['title' => $category->title, 'category_id' => $category->category_id])->one(); return $this->render('index', ['category' => $category, 'categories' => $categories, 'documents' => $documents, 'readme' => $readme]); }