32 lines
1.3 KiB
PHP
32 lines
1.3 KiB
PHP
{{--
|
|
VARIABLE || COMMENT || TYPE || REQUIRED || DEFAULT
|
|
|
|
$id || The id of the input tag. || string || REQUIRED ||
|
|
$name || The name of the input tag. || string || REQUIRED ||
|
|
$helper || The helper of the input. || string || REQUIRED ||
|
|
$placeholder || The placeholder of the input. || string || REQUIRED ||
|
|
$label || The text displayed as a label. || string || OPTIONNAL || null
|
|
$required || Is the field required ? || boolean || OPTIONNAL || false
|
|
$model || The model we're creating/editing || Model class || OPTIONNAL || null
|
|
--}}
|
|
|
|
<label class="col-form-label" for="{{ $id }}">
|
|
<b>{{ $label }} {{ $required ?? false ? '*' : '' }}</b>
|
|
</label>
|
|
@php
|
|
$data = [
|
|
'id' => $id,
|
|
'class' => 'w-100 form-control ' . ($errors->has($name) ? 'is-invalid ' : ''),
|
|
'name' => $name,
|
|
'placeholder' => $placeholder,
|
|
'ariaDescribedby' => "{$id}Help",
|
|
'required' => $required,
|
|
'value' => old($name, $model->{$name} ?? ''),
|
|
];
|
|
@endphp
|
|
<div class="input-text-auto" data-json='@json($data)'></div>
|
|
@include('modules.input-error', [
|
|
'inputName' => $name,
|
|
'helperId' => "{$id}Help",
|
|
'helper' => $helper,
|
|
])
|