@php
$Docs = App\Models\Documents::where(
'employee_id',
$sick->employee_id,
)
->where(
'filepath',
'Sickness/' .
$sick->employee_id .
'/' .
$sick->id,
)
->get();
if (
!function_exists('getFileTypeIcon')
) {
function getFileTypeIcon($extension)
{
$icons = [
'docx' =>
'fas fa-file-word text-primary',
'doc' =>
'fas fa-file-word text-primary',
'ppt' =>
'fas fa-file-powerpoint text-orange',
'pptx' =>
'fas fa-file-powerpoint text-orange',
'pdf' =>
'fas fa-file-pdf text-danger',
'xls' =>
'fas fa-file-excel text-success',
'xlsx' =>
'fas fa-file-excel text-success',
'csv' =>
'fas fa-file-csv text-success',
'png' =>
'fas fa-file-image text-info',
'jpg' =>
'fas fa-file-image text-info',
'jpeg' =>
'fas fa-file-image text-info',
'gif' =>
'fas fa-file-image text-info',
'mp4' =>
'fas fa-file-video text-purple',
'default' => 'far fa-file',
];
return $icons[$extension] ??
$icons['default'];
}
}
@endphp
@if ($Docs->count() > 0)
@foreach ($Docs as $doc)
@php
$extension = pathinfo(
$doc->docname,
PATHINFO_EXTENSION,
);
$fileIcon = getFileTypeIcon(
$extension,
);
@endphp
{{ $doc->docname }}
@endforeach
@else
No
documents attached
@endif