コード例 #1
0
ファイル: MetaSearch.php プロジェクト: babagay/razzd
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Meta::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'keywords', $this->keywords])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'route', $this->route]);
     return $dataProvider;
 }
コード例 #2
0
ファイル: Meta.php プロジェクト: babagay/razzd
 public function findMeta($event)
 {
     if (Yii::$app->controller->action->id == 'index') {
         return;
     }
     $route = $this->route;
     $model = \backend\models\Meta::findByRoute($route);
     if (isset($model->id)) {
         $this->owner->meta_title = $model->title;
         $this->owner->meta_keywords = $model->keywords;
         $this->owner->meta_description = $model->description;
     }
 }
コード例 #3
0
ファイル: MetaController.php プロジェクト: babagay/razzd
 /**
  * Finds the Meta model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Meta the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Meta::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }