loadHtml($content); $dompdf->setPaper('A4', 'portrait'); $dompdf->render(); $pdfData = $dompdf->output(); $savePath = public_path('storage/files/') . date('Ymd') . '/pdf'; if (!is_dir($savePath)) { mkdir($savePath, 0777, true); } $filePath = $savePath . '/' . $fileName; file_put_contents($filePath, $pdfData); $url = getenv('STORAGE_DOMAIN') . '/storage/files/' . date('Ymd') . '/pdf/' . $fileName; return $url; } }