File tree Expand file tree Collapse file tree 1 file changed +20
-6
lines changed
resources/views/components/form Expand file tree Collapse file tree 1 file changed +20
-6
lines changed Original file line number Diff line number Diff line change 1
1
@props ([
2
+ ' data' => [],
2
3
' required' => ' ' ,
3
4
' name' => ' ' ,
4
5
' id' => ' ' ,
23
24
24
25
<div class =" mb-5" >
25
26
@if ($label != ' none' )
26
- <x-form . label : $label : $required :$name / >
27
+ <label for = ' {{ $name } } ' class = ' block mb-2 font-bold text-sm mb-2 text-gray-600 dark:text-gray-200 ' > {{ $label } } @if ( $required != ' ' ) < span aria-hidden = " true " class = " error " >*</ span > @endif </ label >
27
28
@endif
28
29
<select
29
30
name =' {{ $name } }'
30
31
id =' {{ $name } }'
31
32
{{ $required } }
32
- {{ $attributes -> merge ([' class' => ' border border-gray-300 bg-white dark:bg-gray-500 dark:text-gray-200 py-2 px-3 w-full rounded-md shadow' ]) } }
33
- @error ($name )
34
- aria-invalid =" true"
35
- aria-description =" {{ $message } }"
36
- @enderror
33
+ {{ $attributes -> merge ([
34
+ ' class' => implode (' ' , [
35
+ ' block w-full bg-white dark:bg-gray-500 dark:text-gray-200 dark:placeholder-gray-200 border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-light-blue-500 focus:border-light-blue-500 sm:text-sm' ,
36
+ $errors -> has ($name ) ? ' border-red-500' : ' border-gray-300' ,
37
+ ])
38
+ ]) } }
39
+ @if (isset ($errors ) )
40
+ @error ($name )
41
+ aria-invalid =" true"
42
+ aria-description =" {{ $message } }"
43
+ @enderror
44
+ @endif
45
+ {{ $attributes } }
37
46
>
38
47
@if ($placeholder != ' ' )
39
48
<option value =' ' >{{ $placeholder } } </option >
40
49
@endif
50
+ @if (count ($data ) > 0 )
51
+ @foreach ($data as $item )
52
+ <option value =" {{ $item [' id' ] } }" >{{ $item [' value' ] } } </option >
53
+ @endforeach
54
+ @endif
41
55
{{ $slot } }
42
56
</select >
43
57
@error ($name )
You can’t perform that action at this time.
0 commit comments