Esempio n. 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Consumer::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(['consumer_id' => $this->consumer_id, 'post_date' => $this->post_date, 'status' => $this->status]);
     $query->andFilterWhere(['like', 'consumer_fname', $this->consumer_fname])->andFilterWhere(['like', 'consumer_lname', $this->consumer_lname])->andFilterWhere(['like', 'consumer_state', $this->consumer_state])->andFilterWhere(['like', 'consumer_pswd', $this->consumer_pswd])->andFilterWhere(['like', 'consumer_name', $this->consumer_name])->andFilterWhere(['like', 'consumer_zip', $this->consumer_zip])->andFilterWhere(['like', 'consumer_email', $this->consumer_email]);
     return $dataProvider;
 }
 public function search($input)
 {
     $query = Consumer::query();
     $columns = Schema::getColumnListing('consumers');
     $attributes = array();
     foreach ($columns as $attribute) {
         if (isset($input[$attribute]) and !empty($input[$attribute])) {
             $query->where($attribute, $input[$attribute]);
             $attributes[$attribute] = $input[$attribute];
         } else {
             $attributes[$attribute] = null;
         }
     }
     return [$query->get(), $attributes];
 }
Esempio n. 3
0
 protected function addControls()
 {
     $this->addControl(\Easy\Form\Textbox::make('~layouts.form.controls.textboxes.textbox')->name('year_faz')->caption('An Faz')->class('form-control  data-source')->controlsource('year_faz')->controltype('textbox')->maxlength(255))->addControl(\Easy\Form\Textbox::make('~layouts.form.controls.comboboxes.combobox')->name('month_faz')->caption('Luna Faz')->class('form-control  data-source input-group form-select init-on-update-delete')->controlsource('month_faz')->controltype('combobox')->options(\App\Models\Consumer::months()))->addControl(\Easy\Form\Textbox::make('~layouts.form.controls.textboxes.textbox')->name('month_distance')->caption('Distanta Lunara Parcursa In Km')->class('form-control  data-source')->controlsource('month_distance')->controltype('textbox')->maxlength(255))->addControl(\Easy\Form\Textbox::make('~layouts.form.controls.textboxes.textbox')->name('monthly_consumption')->caption('Consumul Total Pe Luna In Litri')->class('form-control  data-source')->controlsource('monthly_consumption')->controltype('textbox')->maxlength(255));
 }
 /**
  * Finds the Consumer model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return Consumer the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Consumer::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }