@foreach($files as $index => $file)
@php
// Determine file type for icon and badge
$extension = pathinfo($file->file_name, PATHINFO_EXTENSION);
$fileType = strtolower($extension);
$iconClass = 'fa-file';
$badgeClass = 'file-type-other';
if(in_array($fileType, ['pdf'])) {
$iconClass = 'fa-file-pdf text-danger';
$badgeClass = 'file-type-pdf';
} elseif(in_array($fileType, ['doc', 'docx'])) {
$iconClass = 'fa-file-word text-primary';
$badgeClass = 'file-type-doc';
} elseif(in_array($fileType, ['zip', 'rar', '7z'])) {
$iconClass = 'fa-file-zipper text-warning';
$badgeClass = 'file-type-zip';
} elseif(in_array($fileType, ['jpg', 'jpeg', 'png', 'gif'])) {
$iconClass = 'fa-file-image text-success';
} elseif(in_array($fileType, ['mp4', 'avi', 'mov'])) {
$iconClass = 'fa-file-video text-info';
}
@endphp
{{ $file->file_name }}
@if(in_array($fileType, ['pdf', 'doc', 'docx', 'zip']))
{{ strtoupper($fileType) }}
@endif
@if(isset($file->file_size))
{{ $file->file_size > 1024 ? round($file->file_size/1024, 2) . ' MB' : $file->file_size . ' KB' }}
@endif
{{ isset($file->created_at) ? \Carbon\Carbon::parse($file->created_at)->format('d M Y') : date('d M Y') }}
@if(isset($file->download_count))
{{ $file->download_count }} downloads
@endif
Download
@endforeach