selectRange() public method

Create a select range field.
public selectRange ( string $name, string $begin, string $end, string $selected = null, array $options = [] ) : Illuminate\Support\HtmlString
$name string
$begin string
$end string
$selected string
$options array
return Illuminate\Support\HtmlString
Exemplo n.º 1
0
 public function selectRangeWithInterval(string $name, int $start, int $end, int $interval, int $value = null, array $options = []) : string
 {
     if ($interval == 0) {
         return parent::selectRange($name, $start, $end, $value, $options);
     }
     $items = [];
     $items[$value] = $value;
     $startValue = $start;
     $endValue = $end;
     $interval *= $interval < 0 ? -1 : 1;
     if ($start > $end) {
         $interval *= $interval > 0 ? -1 : 1;
         $startValue = $end;
         $endValue = $start;
     }
     for ($i = $startValue; $i < $endValue; $i += $interval) {
         $items[$i . ""] = $i;
     }
     $items[$endValue] = $endValue;
     return $this->select($name, $items, $value, $options);
 }
Exemplo n.º 2
0
 /**
  * Create a select range field.
  *
  * @param string $name
  * @param string $begin
  * @param string $end
  * @param string $selected
  * @param array $options
  * @return string 
  * @static 
  */
 public static function selectRange($name, $begin, $end, $selected = null, $options = array())
 {
     return \Collective\Html\FormBuilder::selectRange($name, $begin, $end, $selected, $options);
 }
Exemplo n.º 3
0
 /**
  * Create a select range field.
  *
  * @param  string  $name
  * @param  string  $begin
  * @param  string  $end
  * @param  string  $selected
  * @param  array   $options
  *
  * @return string
  */
 public function selectRange($name, $begin, $end, $selected = null, $options = [])
 {
     $this->addErrorClass($name, $options);
     $tags['input'] = parent::selectRange($name, $begin, $end, $selected, $options);
     $tags['error'] = $this->getErrorTag($name);
     return $this->buildTags($tags);
 }