You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
1.1 KiB
29 lines
1.1 KiB
@props([
|
|
'label' => '',
|
|
'name' => '',
|
|
'feedback' => null,
|
|
'disabled' => false
|
|
])
|
|
|
|
@php
|
|
$name = $attributes->has('wire:model') ? $attributes->get('wire:model') : $name;
|
|
@endphp
|
|
|
|
<div class="form-group" @if ($attributes->has('x-show')) x-show="{{ $attributes->get('x-show') }}" x-cloak @endif>
|
|
<label for="{{ $name }}">{{ $label }}</label>
|
|
<input
|
|
{{ $attributes->merge([
|
|
'class' => 'form-control' . ($errors->has($name) ? ' is-invalid' : ''),
|
|
'name' => $name,
|
|
'disabled' => $disabled,
|
|
'id' => $attributes->has('id') ? $attributes->get('id') : $name,
|
|
'placeholder' => $attributes->has('placeholder') ? $attributes->get('placeholder') : $label,
|
|
'x-bind:class' => $feedback ? "{'is-invalid': feedback?.$name}" : false,
|
|
]) }} />
|
|
@if ($feedback)
|
|
<span x-text="feedback?.{{ $name }}"
|
|
x-bind:class="{ 'invalid-feedback': feedback?.{{ $name }} }"></span>
|
|
@elseif ($errors->has($name))
|
|
<span class="invalid-feedback">{{ $errors->first($name) }}</span>
|
|
@endif
|
|
</div>
|
|
|