@props([ 'label' => null, 'name' => null, 'type' => 'text', 'value' => null, 'hint' => null, 'required' => false, 'autocomplete' => null, ]) @php /* | Wraps label + control + error into one unit so no form can accidentally | ship an input without its error message wired up. Errors are read from | the bag by field name rather than passed in, which is what keeps | validation feedback consistent across every form in the product. */ $id = $attributes->get('id', $name); $hasError = $name && $errors->has($name); $describedBy = collect([ $hint ? "{$id}-hint" : null, $hasError ? "{$id}-error" : null, ])->filter()->implode(' '); @endphp
{{ $hint }}
@endif @if ($hasError){{ $errors->first($name) }}
@endif