D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
html
/
epaji.com
/
public_html
/
hindiusa
/
models
/
Filename :
EventsSearch.php
back
Copy
<?php namespace app\models; use yii\base\Model; use yii\data\ActiveDataProvider; use app\models\Events; /** * EventsSearch represents the model behind the search form of `app\models\Events`. */ class EventsSearch extends Events { /** * {@inheritdoc} */ public function rules() { return [ [['id', 'seat', 'status'], 'integer'], [['title', 'summary', 'description', 'start_date', 'start_time', 'end_date', 'end_time', 'venue', 'created','school_id', 'event_type_id'], 'safe'], ]; } /** * {@inheritdoc} */ public function scenarios() { // bypass scenarios() implementation in the parent class return Model::scenarios(); } /** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Events::find(); // add conditions that should always apply here $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->joinWith(['school','eventType']); // grid filtering conditions $query->andFilterWhere([ 'events.id' => $this->id, 'events.status' => $this->status, ]); $query->andFilterWhere(['like', 'events.title', $this->title]) ->andFilterWhere(['like', 'schools.name', $this->school_id]) ->andFilterWhere(['like', 'event_types.name', $this->event_type_id]); return $dataProvider; } }