1
0

select.blade.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. @props([
  2. 'name',
  3. 'id' => null,
  4. 'label' => null,
  5. 'options' => [],
  6. 'multiple' => false,
  7. 'placeholder' => null,
  8. 'required' => false,
  9. 'help' => null,
  10. 'useSelectpicker' => true,
  11. 'attribute' => null,
  12. 'label_grid' => 'col-xxl-2 col-lg-3 col-sm-4',
  13. 'input_grid' => 'col-xxl-4 col-xl-5 col-md-6 col-sm-8',
  14. 'container' => 'form-group row',
  15. ])
  16. <div class="{{ $container }}">
  17. <label class="{{ $label_grid }} col-form-label" for="{{ $id ?? $name }}">{{ $label }}</label>
  18. <div class="{{ $input_grid }}">
  19. <select class="form-control show-tick" id="{{ $id ?? $name }}" name="{{ $name }}{{ $multiple ? '[]' : '' }}"
  20. @if ($multiple) multiple @endif @if ($required) required @endif
  21. @if ($useSelectpicker) data-plugin="selectpicker" data-style="btn-outline btn-primary" @endif {{ $attribute }}>
  22. @if ($placeholder)
  23. <option value="">{{ $placeholder }}</option>
  24. @endif
  25. @foreach ($options as $value => $text)
  26. <option value="{{ $value }}">
  27. {{ $text }}
  28. </option>
  29. @endforeach
  30. {{ $slot }}
  31. </select>
  32. @if ($help)
  33. <span class="text-help">{{ $help }}</span>
  34. @endif
  35. </div>
  36. </div>