fix: provide full mPDF configuration to avoid null array offset errors

This commit is contained in:
2026-05-01 09:42:05 -04:00
parent 4b9220c89e
commit 23b0b30434
+12 -5
View File
@@ -284,13 +284,20 @@ class PagesController extends Controller
];
// Configure mPDF to use a writable directory
$config = [
'temp_dir' => storage_path('temp')
];
if (!file_exists(storage_path('temp'))) {
mkdir(storage_path('temp'), 0755, true);
$writableTemp = storage_path('temp');
if (!file_exists($writableTemp)) {
mkdir($writableTemp, 0755, true);
}
$config = [
'tempDir' => $writableTemp,
'mode' => 'utf-8',
'format' => 'letter',
'author' => 'St John Church',
'creator' => 'St John Church',
'display_mode' => 'fullpage',
];
$pdf = PDF::loadView('receiptpdf', $checkout_data, [], $config);
return $pdf->download('receipt-'.$checkoutid.'.pdf');
}