Laravel 11, Vuexy Admin 10.3, by admin@koneko.mx
This commit is contained in:
13
resources/views/components/form/checkbox.blade.php
Normal file
13
resources/views/components/form/checkbox.blade.php
Normal file
@ -0,0 +1,13 @@
|
||||
@php
|
||||
$livewireModel = $attributes->get('wire:model', $attributes->get('wire:model.defer'));
|
||||
$name = $attributes->get('name', $livewireModel);
|
||||
$id = $attributes->get('id', $name);
|
||||
$parentClass = $attributes->get('parent_class', 'form-check-secondary'); // Uso de la segunda opción de $attributes->get()
|
||||
$checked = isset($checked) && $checked? 'checked' : ''; // Asegurarse de que la variable esté definida y sea booleana
|
||||
@endphp
|
||||
<div class="form-check {{ $parentClass }}">
|
||||
<input type="checkbox" id="{{ $id }}" name="{{ $name }}" {!! $attributes->except(['id', 'name', 'parent_class'])->merge(['class' => 'form-check-input']) !!} {{ $checked }}>
|
||||
<label class="form-check-label" for="{{ $id }}">
|
||||
{{ $slot }}
|
||||
</label>
|
||||
</div>
|
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