Пример #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = StaticPages::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(['staticId' => $this->staticId, 'createdBy' => $this->createdBy, 'updatedBy' => $this->updatedBy, 'createdDate' => $this->createdDate, 'updatedDate' => $this->updatedDate]);
     $query->andFilterWhere(['like', 'pageTitle', $this->pageTitle])->andFilterWhere(['like', 'pageContent', $this->pageContent])->andFilterWhere(['like', 'seoKeys', $this->seoKeys])->andFilterWhere(['like', 'metaKeys', $this->metaKeys])->andFilterWhere(['like', 'status', $this->status])->andFilterWhere(['like', 'ipAddress', $this->ipAddress]);
     return $dataProvider;
 }
Пример #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getStaticPages0()
 {
     return $this->hasMany(StaticPages::className(), ['updatedBy' => 'id']);
 }
Пример #3
0
 /**
  * Finds the Staticpages model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Staticpages the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = StaticPages::findOne($id)) !== null) {
         $admincreatedModel = AdminMaster::findOne($model->createdBy);
         $adminupdatedModel = AdminMaster::findOne($model->updatedBy);
         $model->createdBy = $admincreatedModel->username;
         $model->updatedBy = $adminupdatedModel->username;
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Пример #4
0
 /**
  * Finds the StaticPages model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return StaticPages the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = StaticPages::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }