Fix Laravel Pint formatting

This commit is contained in:
root
2026-06-09 00:03:03 -04:00
parent 8d4d610b82
commit b5fd4a4ca1
1414 changed files with 11317 additions and 10201 deletions
@@ -7,12 +7,13 @@ namespace App\Services\Certificates;
class CertificatePdfService
{
private string $fontDir;
private string $imgDir;
public function __construct()
{
$this->fontDir = public_path('assets/certificates/fonts') . DIRECTORY_SEPARATOR;
$this->imgDir = public_path('assets/certificates/images') . DIRECTORY_SEPARATOR;
$this->fontDir = public_path('assets/certificates/fonts').DIRECTORY_SEPARATOR;
$this->imgDir = public_path('assets/certificates/images').DIRECTORY_SEPARATOR;
}
/**
@@ -20,9 +21,9 @@ class CertificatePdfService
*/
public function generate(array $students, string $certDate): string
{
$edwardianFont = \TCPDF_FONTS::addTTFfont($this->fontDir . 'Edwardian Script ITC Regular.ttf', 'TrueTypeUnicode', '', 32);
$garamondBold = \TCPDF_FONTS::addTTFfont($this->fontDir . 'Garamond Bold.ttf', 'TrueTypeUnicode', '', 32);
$ebGaramond = \TCPDF_FONTS::addTTFfont($this->fontDir . 'EBGaramond-Regular.ttf', 'TrueTypeUnicode', '', 32);
$edwardianFont = \TCPDF_FONTS::addTTFfont($this->fontDir.'Edwardian Script ITC Regular.ttf', 'TrueTypeUnicode', '', 32);
$garamondBold = \TCPDF_FONTS::addTTFfont($this->fontDir.'Garamond Bold.ttf', 'TrueTypeUnicode', '', 32);
$ebGaramond = \TCPDF_FONTS::addTTFfont($this->fontDir.'EBGaramond-Regular.ttf', 'TrueTypeUnicode', '', 32);
$pdf = new \TCPDF('L', 'pt', 'A4', true, 'UTF-8', false);
$pdf->SetCreator('Al Rahma Sunday School');
@@ -39,7 +40,7 @@ class CertificatePdfService
foreach ($students as $student) {
$pdf->AddPage();
$name = $student['firstname'] . ' ' . $student['lastname'];
$name = $student['firstname'].' '.$student['lastname'];
$grade = $this->formatGrade((string) ($student['grade'] ?? ''));
$certNumber = (string) ($student['cert_number'] ?? '');
$verifyUrl = is_string($student['verify_url'] ?? null) ? $student['verify_url'] : null;
@@ -64,8 +65,8 @@ class CertificatePdfService
private function drawCertificate(
\TCPDF $pdf,
float $W,
float $H,
float $W,
float $H,
string $name,
string $grade,
string $certDate,
@@ -75,9 +76,9 @@ class CertificatePdfService
string $garamondBold,
string $ebGaramond
): void {
$pdf->Image($this->imgDir . 'title.png', 126, 0, 600);
$pdf->Image($this->imgDir . 'background.png', 280, 176, 291, 340);
$pdf->Image($this->imgDir . 'signature.png', 140, 410, 90, 80);
$pdf->Image($this->imgDir.'title.png', 126, 0, 600);
$pdf->Image($this->imgDir.'background.png', 280, 176, 291, 340);
$pdf->Image($this->imgDir.'signature.png', 140, 410, 90, 80);
$pdf->SetFont('times', 'B', 24);
$pdf->SetTextColor(0, 0, 0);
@@ -135,7 +136,7 @@ class CertificatePdfService
$pdf->SetFont('helvetica', '', 8);
$pdf->SetTextColor(150, 150, 150);
$pdf->SetXY(70.86, $H - 39.68);
$pdf->Cell(200, 12, 'Certificate No. ' . $certNumber, 0, 0, 'L');
$pdf->Cell(200, 12, 'Certificate No. '.$certNumber, 0, 0, 'L');
$pdf->SetTextColor(0, 0, 0);
}
}
@@ -161,7 +162,7 @@ class CertificatePdfService
$lower = strtolower($clean);
if (preg_match('/^\d+$/', $clean) && (int) $clean >= 1 && (int) $clean <= 9) {
return 'Grade ' . $clean;
return 'Grade '.$clean;
}
if ($lower === 'youth') {
return 'Youth';