public function actionIndex() { $model = Logo::find()->orderBy('id')->one(); if ($model === null) { $model = new Logo(); } if ($model->load(Yii::$app->request->post()) && $model->save()) { } return $this->render('update', ['model' => $model]); }
/** * 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; }
<?php 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;