blob: bd6f7c094f787768de5f66f24a17fb3219d12458 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
@props([
'name',
'label',
'options' => [],
'value' => null,
'required' => false,
'placeholder' => 'Select an option'
])
<div class="mb-3">
<label for="{{ $name }}" class="form-label">
{{ $label }}
@if($required)
<span class="text-danger">*</span>
@endif
</label>
<select
class="form-select @error($name) is-invalid @enderror"
id="{{ $name }}"
name="{{ $name }}"
{{ $required ? 'required' : '' }}
{{ $attributes }}
>
<option value="">{{ $placeholder }}</option>
@foreach($options as $optionValue => $optionLabel)
<option value="{{ $optionValue }}" {{ old($name, $value) == $optionValue ? 'selected' : '' }}>
{{ $optionLabel }}
</option>
@endforeach
</select>
@error($name)
<div class="invalid-feedback">{{ $message }}</div>
@enderror
</div>
|