Laravel 11, Vuexy Admin 10.3, by admin@koneko.mx
This commit is contained in:
25
resources/views/components/form/select.blade.php
Normal file
25
resources/views/components/form/select.blade.php
Normal file
@ -0,0 +1,25 @@
|
||||
@props([
|
||||
'options' => [],
|
||||
'name' => null,
|
||||
'placeholder' => '',
|
||||
'selected' => null,
|
||||
'id' => null
|
||||
])
|
||||
|
||||
@php
|
||||
$livewireModel = $attributes->get('wire:model', $attributes->get('wire:model.defer'));
|
||||
$name = $attributes->get('name', $livewireModel);
|
||||
$id = $attributes->get('id', $name);
|
||||
$options = is_array($options) ? collect($options) : $options;
|
||||
@endphp
|
||||
|
||||
<select id="{{ $id }}" name="{{ $name }}" {{ $attributes->merge(['class' => 'form-select']) }}>
|
||||
@if(!empty($placeholder))
|
||||
<option value="">{{ $placeholder }}</option>
|
||||
@endif
|
||||
@foreach($options as $key => $value)
|
||||
<option value="{{ $key }}" {{ (string) $key === (string) old($name, $selected) ? 'selected' : '' }}>
|
||||
{{ $value }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
Reference in New Issue
Block a user