@php // Document extensions are matched case-insensitively and safely handle a // null original_name or a name without a dot. $isDocumentFile = function (?string $name): bool { return in_array(strtolower(pathinfo((string) $name, PATHINFO_EXTENSION)), ['pdf', 'csv', 'xls', 'xlsx'], true); }; @endphp