@foreach($files as $file)
@php
$ext = strtolower(pathinfo($file->filename, PATHINFO_EXTENSION));
$icon = match(true) {
in_array($ext, ['jpg','jpeg','png','gif','webp']) => 'bi-file-image text-success',
$ext === 'pdf' => 'bi-file-pdf text-danger',
in_array($ext, ['doc','docx']) => 'bi-file-word text-primary',
in_array($ext, ['xls','xlsx']) => 'bi-file-excel text-success',
in_array($ext, ['zip','rar','7z','gz','tar']) => 'bi-file-zip text-warning',
default => 'bi-file-earmark text-secondary',
};
@endphp
{{ $file->filename }}
@can('update', $project)
@endcan
{{-- 說明(靜態) --}}
{{ $file->description ?: '(無說明)' }}
{{-- 說明(編輯表單,預設隱藏) --}}
@can('update', $project)
@endcan
{{ $file->uploader ?? '—' }}
·
{{ $file->created_at->format('Y-m-d') }}
@endforeach