@props([
'file' => null,
'accept' => 'image/jpg,image/jpeg,image/png,image/svg+xml',
'multiple' => false,
])
@if(! $file)
@php $randomId = Str::random(6); @endphp
@endif
{{-- Loading indicator for file remove --}}
{{ __('Removing file...') }}
{{-- Preview for mode 'attachment' --}}
@if(is_array($file) && count($file) > 0)
@foreach($file as $key => $f)
@if(collect(['jpg', 'png', 'jpeg', 'webp'])->contains($f->getClientOriginalExtension()))
@else
@endif
@if ($multiple)
{{-- prints attachment.* --}}
@error($attributes->wire('model')->value . '.'. $key)
{{ $message }}
@enderror
@endif
{{ $f->getClientOriginalName() }}
{{ Str::formatBytes($f->getSize()) }}
•
{{ $f->getClientOriginalExtension() }}
@endforeach
@else
@if($file)
@if(collect(['jpg', 'png', 'jpeg', 'webp', 'svg'])->contains($file->getClientOriginalExtension()))
@else
@endif
@error($attributes->wire('model')->value)
{{ $message }}
@enderror
{{ $file->getClientOriginalName() }}
{{ Str::formatBytes($file->getSize()) }}
•
{{ $file->getClientOriginalExtension() }}
@endif
@endif