@props([ 'name', 'label' => null, 'hint' => null, 'required' => false, 'existing' => null, 'preview' => true, ]) @php $id = $attributes->get('id', $name); $error = $errors->first($name); $existingUrl = $existing ? asset_path($existing) : null; $isImage = $existingUrl && preg_match('/\.(jpe?g|png|gif|webp|svg)$/i', $existing); @endphp
only('class') }} @if ($preview) x-data="imageField({{ $isImage ? "'".$existingUrl."'" : 'null' }})" @endif> @if ($label) @endif @if ($preview)
{{-- Tells the controller to clear the stored path even when no new file is chosen. --}} @elseif ($existingUrl)

Current file: view

@endif except('class')->merge([ 'class' => 'block w-full text-sm text-text-secondary file:mr-3 file:rounded-lg file:border-0 file:bg-primary-50 file:px-4 file:py-2 file:text-sm file:font-medium file:text-primary hover:file:bg-primary-100', ]) }}> @if ($hint && ! $error)

{{ $hint }}

@endif @if ($error)

{{ $error }}

@endif