/** * Finds the Logo model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Logo the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Logo::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Logo::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id]); $query->andFilterWhere(['like', 'photo', $this->photo]); return $dataProvider; }
use yii\helpers\Html; use frontend\assets\AppAsset; use common\models\Config; use common\models\Logo; use common\models\Slider; use common\models\Category; use common\models\Setting; /* @var $this \yii\web\View */ /* @var $content string */ $this->title = 'SunFrogShirts'; AppAsset::register($this); $categories = Category::find()->select('id, name')->orderBy('priority ASC, name')->all(); $setting_id = Setting::find()->select('name,value')->where('active = 1')->one(); $logo = Logo::find()->orderBy('id')->one(); if ($logo === null) { $logo = new Logo(); } $this->beginPage(); ?> <!DOCTYPE html> <html lang="<?php echo Yii::$app->language; ?> "> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta charset="<?php echo Yii::$app->charset; ?> ">