@php use Illuminate\Support\Str; @endphp @props([ 'name', 'label' => $name ?? '', 'required' => false, 'value' => null, 'useLabel' => true, 'readonly' => false, 'accept' => null, 'path' => '', ]) @php $nameId = !empty($name) ? Str::slug($name) : uniqid(); $modalId = 'modal-file-' . $nameId; @endphp
@if($value) @php $fileUrl = asset($path . $value); $ext = strtolower(pathinfo($value, PATHINFO_EXTENSION)); $fileExts = ['jpg', 'jpeg', 'png', 'pdf', 'gif', 'webp']; @endphp
@if(in_array($ext, $fileExts) && $path) @endif
@endif
class(['form-control', 'is-invalid' => $errors->has($name)]) }} id="input-{{ $nameId }}" type="file" name="{{ $name }}" aria-label="{{ __('general.choose_file') }}" placeholder="{{ __('general.choose_file') }}" {{ $readonly ? 'readonly tabindex=-1' : '' }} @required($required) accept="{{ $accept }}" style="height: 58px; min-width: 0; flex: 1 1 auto;" /> @if($value && in_array($ext ?? '', $fileExts ?? []) && $path) @endif @if($useLabel) @endif
@error($name)
{{ $message }}
@enderror