@php $canArchiveDoc = in_array($document->document_type, ['records', 'bulletins'], true) && (auth()->user()?->can('manage-documents') || $document->created_by === auth()->id()); @endphp Back @if($document->file_path) Download @endif @can('update', $document) @if($document->file_path) Replace File @endif @if($document->document_type === 'controlled_documents') New Version @endif Edit @endcan @if($canArchiveDoc) @endif