company_id === (int) company_id() && $agreementSignature->archivedCourierContractPayload() !== null, 404); $path = match ($kind) { 'signed' => $agreementSignature->signed_pdf_path, 'certificate' => $agreementSignature->certificate_path, default => abort(404), }; abort_if(blank($path) || ! Storage::disk('uploads')->exists($path), 404, '归档附件不存在,请核对协议签署记录。'); $suffix = $kind === 'signed' ? '已签署合作合同' : '签署完成证书'; return Storage::disk('uploads')->response($path, $agreementSignature->business_no . '-' . $suffix . '.pdf', ['Content-Type' => 'application/pdf'], request()->boolean('preview') ? 'inline' : 'attachment'); } }