Beispiel #1
0
 /**
  * Фильтр: диапазон чисел
  *
  * @param      $form_field
  * @param      $label
  * @param null $db_field
  */
 function addFilterRangeNumericSlider($form_field, $label, $min = null, $max = null, $db_field = null)
 {
     if (!$db_field) {
         $db_field = $form_field;
     }
     larastatic('bootstrap-slider');
     $value = \Input::get($form_field, $min . ',' . $max);
     $el = $this->form->putTbSlider($form_field)->setLabel($label)->setValue($value)->setOptionMax($max)->setOptionMin($min);
     $gr = $this->form->putTbGroup()->setAttribute('rel', $el->getId())->addClass('js-slider-group');
     $from_name = 'from_' . $form_field;
     $to_name = 'to_' . $form_field;
     $gr->putTbInt($from_name)->setWrapClass('col-md-6')->addClass('js-slider-min');
     $gr->putTbInt($to_name)->setWrapClass('col-md-6')->addClass('js-slider-max');
     $values = explode(',', $value);
     $this->form->initValues([$from_name => Arr::get($values, 0), $to_name => Arr::get($values, 1)]);
     \LaraJs::addInline('');
     $value = \Input::get($form_field);
     if ($value) {
         $values = explode(',', $value);
         $values = $this->ids($values);
         $this->model->whereBetween($db_field, $values);
     }
 }