Ejemplo n.º 1
0
 public function actionCategory($id)
 {
     if (!Yii::$app->user->can('show', Yii::$app->user->identity)) {
         Yii::$app->session->setFlash('expires', true);
     }
     $category = Categories::find()->where('id=:id', [':id' => $id])->one();
     if (empty($category)) {
         throw new \yii\web\NotFoundHttpException(Yii::t('app', '<p>There are currently no pages of content associated with this category. Please check back again!</p>'));
     }
     return $this->render('category', compact('category'));
 }
Ejemplo n.º 2
0
 public function init()
 {
     $this->categories = Categories::find()->orderBy('category')->all();
     $this->pdfs = Pdfs::find()->count();
 }
Ejemplo n.º 3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCategories()
 {
     return $this->hasOne(Categories::className(), ['id' => 'categories_id']);
 }