@props([
'file' => null,
'accept' => 'image/jpg,image/jpeg,image/png,application/pdf',
'multiple' => false,
'mode' => 'attachment',
'profileClass' => 'w-20 h-20 rounded-full'
])
@if(! $file || $mode === 'profile')
@php $randomId = Str::random(6); @endphp
@endif
@if ($mode === 'attachment')
{{-- Loading indicator for file remove --}}
{{-- 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() }}
•
{{ $f->getClientOriginalExtension() }}
@endforeach
@else
@if($file)
@if(collect(['jpg', 'png', 'jpeg', 'webp'])->contains($file->getClientOriginalExtension()))
@else
@endif
@error($attributes->wire('model')->value)
{{ $message }}
@enderror
{{ $file->getClientOriginalName() }}
•
{{ $file->getClientOriginalExtension() }}
@endif
@endif
@endif