public function actionIndex() { $mainSlider = Slider::find()->all(); $gallery = Gallery::find()->all(); $blog = Blog::find()->limit(2)->all(); return $this->render('index', ['mainSlider' => $mainSlider, 'gallery' => $gallery, 'blog' => $blog]); }
public function actionIndex() { $categoryModel = Category::find()->All(); $projectModel = Project::find()->where(['show_in_index' => '1'])->limit(6)->all(); $customerModel = Customer::find()->All(); $applicationConfig = ApplicationConfig::find()->one(); $newsModel = News::find()->where(['show_in_index' => '1'])->limit(2)->all(); $galleryModel = Gallery::find()->orderBy(new Expression('rand()'))->limit(6)->all(); $visitor = ApplicationConfig::findOne(1); $visitor->visitors_count = $visitor->visitors_count + 1; $visitor->save(); return $this->render('index', ['categoryModel' => $categoryModel, 'projectModel' => $projectModel, 'customerModel' => $customerModel, 'applicationConfig' => $applicationConfig, 'newsModel' => $newsModel, 'galleryModel' => $galleryModel]); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Gallery::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]); $query->andFilterWhere(['like', 'title_en', $this->title_en])->andFilterWhere(['like', 'title_pt', $this->title_pt])->andFilterWhere(['like', 'summary_en', $this->summary_en])->andFilterWhere(['like', 'summary_pt', $this->summary_pt]); return $dataProvider; }
public function actionIndex($sid = null) { if (!($models = Gallery::find()->andWhere(['active' => 1])->orderBy(['sort' => SORT_ASC, 'id' => SORT_ASC])->all())) { throw new NotFoundHttpException('The requested page does not exist.'); } if ($sid) { $model = Gallery::findOne(['sid' => $sid]); } if (!isset($model)) { return $this->redirect(['index', 'sid' => $models[0]->sid, '#' => 'menu']); } $this->layout = 'gallery'; return $this->render('index', ['model' => Gallery::findOne($model->id), 'models' => $models]); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Gallery::find(); // add conditions that should always apply here $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['sort' => SORT_ASC]]]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } // grid filtering conditions $query->andFilterWhere(['id' => $this->id, 'active' => $this->active, 'sort' => $this->sort]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'description', $this->description]); return $dataProvider; }
/** * Lists all Gallery models. * @return mixed */ public function actionIndex() { $dataProvider = new ActiveDataProvider(['query' => Gallery::find()]); return $this->render('index', ['dataProvider' => $dataProvider]); }
public function actionTmp() { $model = Gallery::find()->where(['id_tour' => '43'])->all(); return $this->render('tmp', ['model' => $model]); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $category = Gallery::find($id); $category->update(['is_published' => $category->is_published ? 0 : 1]); return Redirect::route('galleries.admin'); }
public function actionIndex() { $galleryModel = Gallery::find()->joinWith('category', 'category.category_id = gallery.category_id')->all(); return $this->render('index', ['galleryModel' => $galleryModel, 'categoryModel' => CategoryGallery::find()->all()]); }