コード例 #1
0
ファイル: ProfilSearch.php プロジェクト: cakpep/spk-tht
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = UserProfil::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'user_id' => $this->user_id, 'agama_id' => $this->agama_id, 'tinggi_badan' => $this->tinggi_badan, 'berat_badan' => $this->berat_badan, 'tgl_lahir' => $this->tgl_lahir, 'updated_by' => $this->updated_by, 'updated_date' => $this->updated_date]);
     $query->andFilterWhere(['like', 'nama', $this->nama])->andFilterWhere(['like', 'jenkel', $this->jenkel])->andFilterWhere(['like', 'tempat_lahir', $this->tempat_lahir])->andFilterWhere(['like', 'alamat', $this->alamat])->andFilterWhere(['like', 'no_telp', $this->no_telp]);
     return $dataProvider;
 }
コード例 #2
0
ファイル: UserProfilSearch.php プロジェクト: cakpep/spk-tht
 public function search($params)
 {
     $query = UserProfil::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['id' => 'DESC']], 'pagination' => ['defaultPageSize' => 10]]);
     $this->load($params);
     if (!$this->validate()) {
         $query->where('1=0');
         return $dataProvider;
     }
     $dataProvider->query->joinWith(['agama' => function ($q) {
         $q->from('user_agama a');
         // join with tabel alias
     }]);
     $dataProvider->query->joinWith(['user' => function ($q) {
         $q->from('user u');
         // join with tabel alias
     }]);
     $query->orFilterWhere(['like', 'a.name', $this->srch_all])->orFilterWhere(['like', 'u.username', $this->srch_all])->orFilterWhere(['like', 'nama', $this->srch_all])->orFilterWhere(['like', 'jenkel', $this->srch_all])->orFilterWhere(['like', 'tempat_lahir', $this->srch_all])->orFilterWhere(['like', 'alamat', $this->srch_all])->orFilterWhere(['like', 'no_telp', $this->srch_all])->orFilterWhere(['like', 'tinggi_badan', $this->srch_all])->orFilterWhere(['like', 'berat_badan', $this->srch_all])->orFilterWhere(['like', 'tgl_lahir', $this->srch_all]);
     $query->andFilterWhere(['user_id' => $this->user_id, 'u.status' => $this->status, 'agama_id' => $this->agama_id]);
     return $dataProvider;
 }
コード例 #3
0
ファイル: UserController.php プロジェクト: cakpep/spk-tht
 protected function findProfil($id)
 {
     if (($model = UserProfil::find()->where(['user_id' => $id])->one()) !== null) {
         return $model;
     } else {
         return null;
     }
 }
コード例 #4
0
ファイル: ProfilController.php プロジェクト: cakpep/spk-tht
 protected function findModel($id)
 {
     $model = UserProfil::find()->where(['user_id' => $id])->one();
     return $model;
 }