@extends('layouts.app') @php $pageTitle = $decision['title'] ?? 'Report Details'; // Try to get text from the first successfully extracted PDF $pdfText = ''; if (isset($extractedPreviews) && is_array($extractedPreviews)) { foreach ($extractedPreviews as $preview) { if (!empty($preview['text'])) { $pdfText = $preview['text']; break; } } } // Use PDF text if available, fallback to hidden indexable content, then description $rawText = !empty($pdfText) ? $pdfText : ($decision['details']['metadata']['hidden_indexable_content'] ?? ($decision['description'] ?? '')); // Remove boilerplate lines before generating the snippet $rawText = preg_replace('/^.*(?:Crown copyright|All times are UTC).*$/mi', '', $rawText); $cleanText = trim(preg_replace('/\s+/', ' ', strip_tags($rawText))); $extract = \Illuminate\Support\Str::limit($cleanText, 200); $metaDescription = 'Accident Report - ' . $extract; @endphp @section('title', $pageTitle) @section('meta_description', $metaDescription) @section('content')
@php $publishedDate = $decision['public_updated_at'] ?? ($decision['first_published_at'] ?? null); @endphp Published on {{ $publishedDate ? \Carbon\Carbon::parse($publishedDate)->format('d F Y, H:i') : 'Unknown' }}
This overview has been truncated. Please refer to the official documents below for the complete canonical report.
'; } @endphp {!! $truncatedBody !!}Extracted text from the first few pages of the official documents.
Text truncated. The original document has {{ $preview['total_pages'] }} pages.
No text could be extracted from this document.
@endif{{ $history['note'] ?? 'Updated' }}
Raw text extracted from the official documents.
Search the database for other reports involving these entities.