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
@@ -2,8 +2,8 @@
namespace App\Services\Frontend;
use App\Models\ContactUs;
use App\Models\Configuration;
use App\Models\ContactUs;
use App\Services\Email\EmailDispatchService;
use App\Services\System\GlobalConfigService;
use Illuminate\Support\Facades\Log;
@@ -13,8 +13,7 @@ class ContactSubmissionService
public function __construct(
private EmailDispatchService $emailService,
private GlobalConfigService $configService
) {
}
) {}
public function submit(array $payload): array
{
@@ -36,20 +35,20 @@ class ContactSubmissionService
'school_year' => $schoolYear ?: '2025-2026',
]);
} catch (\Throwable $e) {
Log::error('Contact submission save failed: ' . $e->getMessage());
Log::error('Contact submission save failed: '.$e->getMessage());
}
$recipient = Configuration::getConfig('administrator_email')
?: (string) config('mail.from.address', '')
?: 'alrahma.isgl@gmail.com';
$htmlMessage = nl2br('You have received a new message from ' . $email . ":\n\n" . $message);
$htmlMessage = nl2br('You have received a new message from '.$email.":\n\n".$message);
$emailSent = false;
if (!app()->runningUnitTests()) {
if (! app()->runningUnitTests()) {
$emailSent = $this->emailService->send($recipient, $subject, $htmlMessage, null, $email, $email);
if (!$emailSent) {
Log::error('Contact submission email failed for ' . $email);
if (! $emailSent) {
Log::error('Contact submission email failed for '.$email);
}
}
@@ -21,7 +21,7 @@ class LandingPageParentDashboardService
$semester = (string) ($context['semester'] ?? '');
$parentId = $this->primaryParentResolver->resolveFromCredentials($parentUserId, $userType);
if (!$parentId) {
if (! $parentId) {
return [
'ok' => false,
'message' => 'Unable to retrieve student data. Please contact support.',
@@ -38,6 +38,7 @@ class LandingPageParentDashboardService
$classSection = StudentClass::getClassSectionsByStudentId($student['id'], $schoolYear);
$student['class_section'] = $classSection;
$student['grade'] = $classSection;
return $student;
})
->all();
@@ -9,7 +9,7 @@ class LandingPageRoleService
{
public function resolveRole(?User $user): string
{
if (!$user) {
if (! $user) {
return 'guest';
}
@@ -22,7 +22,7 @@ class LandingPageRoleService
->map(fn ($r) => strtolower((string) $r))
->all();
if (!empty($roles)) {
if (! empty($roles)) {
return $roles[0];
}
+3 -4
View File
@@ -11,8 +11,7 @@ class LandingPageService
private LandingPageContextService $contextService,
private LandingPageTeacherSummaryService $teacherSummaryService,
private LandingPageParentDashboardService $parentDashboardService
) {
}
) {}
public function dashboardForUser(?User $user, ?int $classSectionId = null): array
{
@@ -46,7 +45,7 @@ class LandingPageService
public function teacher(?User $user, ?int $classSectionId = null): array
{
if (!$user) {
if (! $user) {
return ['role' => 'teacher', 'dashboard' => 'teacher', 'summary' => []];
}
@@ -67,7 +66,7 @@ class LandingPageService
public function parent(?User $user): array
{
if (!$user) {
if (! $user) {
return ['role' => 'parent', 'dashboard' => 'parent', 'summary' => []];
}
@@ -8,7 +8,6 @@ use App\Models\Calendar;
use App\Models\ClassSection;
use App\Models\ScoreComment;
use App\Models\SemesterScore;
use App\Models\StudentClass;
use App\Models\TeacherClass;
use DateTimeImmutable;
use DateTimeZone;
@@ -16,9 +15,7 @@ use Illuminate\Support\Facades\DB;
class LandingPageTeacherSummaryService
{
public function __construct(private LandingPageContextService $context)
{
}
public function __construct(private LandingPageContextService $context) {}
public function summary(int $teacherId, ?int $requestedClassSectionId = null): array
{
@@ -35,7 +32,7 @@ class LandingPageTeacherSummaryService
$activeId = null;
if ($requestedClassSectionId && in_array($requestedClassSectionId, $availableIds, true)) {
$activeId = $requestedClassSectionId;
} elseif (!empty($availableIds)) {
} elseif (! empty($availableIds)) {
$activeId = $availableIds[0];
}
@@ -48,7 +45,7 @@ class LandingPageTeacherSummaryService
}
$normalizedSemester = ucfirst(strtolower(trim((string) $semester)));
if (!in_array($normalizedSemester, ['Fall', 'Spring'], true)) {
if (! in_array($normalizedSemester, ['Fall', 'Spring'], true)) {
$normalizedSemester = 'Fall';
}
@@ -114,7 +111,7 @@ class LandingPageTeacherSummaryService
];
$uniqueStudentIds = [];
if (!empty($classSectionIds)) {
if (! empty($classSectionIds)) {
$studentRows = DB::table('student_class as sc')
->select('sc.student_id', 'sc.class_section_id')
->join('students as s', 's.id', '=', 'sc.student_id')
@@ -136,7 +133,7 @@ class LandingPageTeacherSummaryService
$summary['attendanceSummary']['students'] = $totalStudents;
$scoreRows = [];
if (!empty($classSectionIds)) {
if (! empty($classSectionIds)) {
$scoreRows = SemesterScore::query()
->select(['student_id', 'class_section_id', 'midterm_exam_score', 'final_exam_score', 'participation_score'])
->whereIn('class_section_id', $classSectionIds)
@@ -214,7 +211,7 @@ class LandingPageTeacherSummaryService
];
$commentRows = [];
if (!empty($uniqueStudentIds)) {
if (! empty($uniqueStudentIds)) {
$commentRows = ScoreComment::query()
->select(['student_id', 'score_type', 'comment', 'comment_review'])
->whereIn('student_id', $uniqueStudentIds)
@@ -238,7 +235,7 @@ class LandingPageTeacherSummaryService
if ($type === '') {
$type = 'general';
}
if (!isset($commentStats[$type])) {
if (! isset($commentStats[$type])) {
$commentStats[$type] = ['pending' => 0, 'reviewed' => 0];
}
@@ -261,7 +258,7 @@ class LandingPageTeacherSummaryService
}
foreach ($expectedCommentTypes as $type) {
if (!isset($commentStats[$type])) {
if (! isset($commentStats[$type])) {
$commentStats[$type] = ['pending' => 0, 'reviewed' => 0];
}
}
@@ -285,7 +282,7 @@ class LandingPageTeacherSummaryService
$completionPct = $totalStudents > 0 ? (int) round(min(100, ($filled / $totalStudents) * 100)) : 0;
$commentTypes[$type] = [
'label' => ucfirst($type) . ' comments',
'label' => ucfirst($type).' comments',
'pending' => $stats['pending'],
'reviewed' => $stats['reviewed'],
'filled' => $filled,
@@ -312,7 +309,7 @@ class LandingPageTeacherSummaryService
];
$attendanceRows = [];
if (!empty($classSectionIds)) {
if (! empty($classSectionIds)) {
$attendanceRows = AttendanceRecord::query()
->select(['student_id', 'class_section_id', 'total_absence'])
->whereIn('class_section_id', $classSectionIds)
@@ -362,7 +359,7 @@ class LandingPageTeacherSummaryService
->get()
->toArray();
if ($attendanceStatus['submitted'] === false && !empty($classSectionIds)) {
if ($attendanceStatus['submitted'] === false && ! empty($classSectionIds)) {
$summary['attendanceSummary']['completionPct'] = 0;
$summary['attendanceSummary']['recorded'] = 0;
}
@@ -377,20 +374,22 @@ class LandingPageTeacherSummaryService
$notifications = [];
$buildScoreLink = static function (?string $focus): string {
$base = '/teacher/scores';
return $focus ? $base . '?focus=' . urlencode($focus) : $base;
return $focus ? $base.'?focus='.urlencode($focus) : $base;
};
$determineFocus = static function (array $event): string {
$eventTypeText = strtolower(trim((string) ($event['event_type'] ?? '')));
if ($eventTypeText !== '' && str_contains($eventTypeText, 'draft')) {
return 'comments';
}
$text = strtolower(trim(($event['title'] ?? '') . ' ' . ($event['description'] ?? '')));
$text = strtolower(trim(($event['title'] ?? '').' '.($event['description'] ?? '')));
if ($text === '') {
return 'scores';
}
if (str_contains($text, 'comment') || str_contains($text, 'ptap')) {
return 'comments';
}
return 'scores';
};
$calendarLink = '/teacher/calendar';
@@ -443,12 +442,13 @@ class LandingPageTeacherSummaryService
$notifications[] = [
'type' => 'danger',
'message' => sprintf(
"Deadline today: %s is due. Submit the remaining entries before the day ends.",
'Deadline today: %s is due. Submit the remaining entries before the day ends.',
$matchedType
),
'link' => $buildScoreLink($eventFocus),
'linkText' => 'Submit now',
];
continue;
}
@@ -460,7 +460,7 @@ class LandingPageTeacherSummaryService
$notifications[] = [
'type' => 'warning',
'message' => sprintf(
"%s is due on %s%s. Review it on the calendar so you dont miss it.",
'%s is due on %s%s. Review it on the calendar so you dont miss it.',
$matchedType,
$eventDateTime->format('M j, Y'),
$relativeText
@@ -470,13 +470,13 @@ class LandingPageTeacherSummaryService
];
}
if (!$activeDeadline) {
if (! $activeDeadline) {
$scoreLabel = $summary['scoreSummary']['fieldLabel'] ?? 'Score';
if (!empty($summary['scoreSummary']['missing'] ?? 0)) {
if (! empty($summary['scoreSummary']['missing'] ?? 0)) {
$notifications[] = [
'type' => 'warning',
'message' => sprintf(
"You have %s %s entries missing on the scores page. Please finish submitting them.",
'You have %s %s entries missing on the scores page. Please finish submitting them.',
(int) $summary['scoreSummary']['missing'],
$scoreLabel
),
@@ -493,20 +493,20 @@ class LandingPageTeacherSummaryService
$notifications[] = [
'type' => 'warning',
'message' => sprintf(
"%s comment missing for %s student(s). Leave comments on the scores page.",
'%s comment missing for %s student(s). Leave comments on the scores page.',
ucfirst($type),
$count
),
'link' => $buildScoreLink('comments'),
'linkText' => ucfirst($type) . ' comments',
'linkText' => ucfirst($type).' comments',
];
}
if (!empty($summary['participationSummary']['missing'] ?? 0)) {
if (! empty($summary['participationSummary']['missing'] ?? 0)) {
$notifications[] = [
'type' => 'warning',
'message' => sprintf(
"Participation entries are still missing for %s student(s). Please add them from the scores page.",
'Participation entries are still missing for %s student(s). Please add them from the scores page.',
(int) $summary['participationSummary']['missing']
),
'link' => $buildScoreLink('scores'),
@@ -515,11 +515,11 @@ class LandingPageTeacherSummaryService
}
}
if (!empty($summary['attendanceStatus']['missingSections'] ?? [])) {
if (! empty($summary['attendanceStatus']['missingSections'] ?? [])) {
$missingNames = $summary['attendanceStatus']['missingNames'] ?? [];
$label = '';
if (!empty($missingNames)) {
$label = ' (' . implode(', ', array_slice($missingNames, 0, 3)) . (count($missingNames) > 3 ? '…' : '') . ')';
if (! empty($missingNames)) {
$label = ' ('.implode(', ', array_slice($missingNames, 0, 3)).(count($missingNames) > 3 ? '…' : '').')';
}
$notifications[] = [
'type' => 'danger',
@@ -564,13 +564,13 @@ class LandingPageTeacherSummaryService
$missingSections = [];
foreach ($classSectionIds as $classSectionId) {
$status = $statusMap[$classSectionId] ?? '';
if (!in_array($status, ['submitted', 'published', 'finalized'], true)) {
if (! in_array($status, ['submitted', 'published', 'finalized'], true)) {
$missingSections[] = $classSectionId;
}
}
$missingNames = [];
if (!empty($missingSections)) {
if (! empty($missingSections)) {
$sectionRows = ClassSection::query()
->select(['class_section_id', 'class_section_name'])
->whereIn('class_section_id', $missingSections)
+2 -2
View File
@@ -9,7 +9,7 @@ class ProfileIconService
public function buildForUser(int $userId): array
{
$user = User::query()->find($userId);
if (!$user) {
if (! $user) {
return [
'userName' => 'User not found',
'userInitials' => '??',
@@ -28,7 +28,7 @@ class ProfileIconService
}
return [
'userName' => trim($firstname . ' ' . $lastname),
'userName' => trim($firstname.' '.$lastname),
'userInitials' => $initials !== '' ? $initials : '??',
];
}
+2 -2
View File
@@ -7,9 +7,9 @@ class StaticPageService
public function load(string $filename, string $type): array
{
$safeName = basename($filename);
$path = public_path('html/' . $safeName);
$path = public_path('html/'.$safeName);
if (!is_file($path) || !is_readable($path)) {
if (! is_file($path) || ! is_readable($path)) {
return [
'ok' => false,
'error' => 'Page content not available.',