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
+27 -17
View File
@@ -20,8 +20,7 @@ class AccountEventService
public function __construct(
private EmailService $emailService,
private UserNotificationDispatchService $notifier
) {
}
) {}
public function newAccountAdded(array $userData): array
{
@@ -29,7 +28,7 @@ class AccountEventService
$message = $this->renderEmail('emails/welcome_user', ['user' => $userData], $subject);
$sent = false;
if (!empty($userData['email'])) {
if (! empty($userData['email'])) {
$sent = $this->emailService->send(
(string) $userData['email'],
$subject,
@@ -41,7 +40,7 @@ class AccountEventService
$supportMessage = $this->renderEmail('emails/support_new_account', ['user' => $userData], $subject);
$this->emailService->send(
'support@alrahmaisgl.org',
'New Account Created: ' . trim((string) ($userData['firstname'] ?? '') . ' ' . (string) ($userData['lastname'] ?? '')),
'New Account Created: '.trim((string) ($userData['firstname'] ?? '').' '.(string) ($userData['lastname'] ?? '')),
$supportMessage,
'notifications'
);
@@ -53,13 +52,14 @@ class AccountEventService
public function studentRegistered(array $data): array
{
if (empty($data['parents']) || !is_array($data['parents'])) {
if (empty($data['parents']) || ! is_array($data['parents'])) {
Log::warning('StudentRegistered: missing parent data');
return ['ok' => false, 'message' => 'Missing parent data.'];
}
$studentFullName = trim((string) ($data['firstname'] ?? '') . ' ' . (string) ($data['lastname'] ?? ''));
if (!empty($data['parents']['user_id'])) {
$studentFullName = trim((string) ($data['firstname'] ?? '').' '.(string) ($data['lastname'] ?? ''));
if (! empty($data['parents']['user_id'])) {
$title = 'Your child has been registered';
$msg = "{$studentFullName} has been successfully registered to Al Rahma Sunday School.";
$this->notifier->notifyUser((int) $data['parents']['user_id'], $title, $msg, ['in_app', 'email'], 'registration', 'parent');
@@ -100,18 +100,21 @@ class AccountEventService
public function userRegistered(array $user): array
{
$this->notifier->notifyUser((int) ($user['id'] ?? 0), 'Welcome!', 'Thanks for registering with our school system.', ['in_app', 'email'], 'notifications', 'parent');
return ['ok' => true];
}
public function userProfileUpdated(array $user): array
{
$this->notifier->notifyUser((int) ($user['id'] ?? 0), 'Profile Updated', 'Your profile information was successfully updated.', ['in_app'], 'notifications', 'parent');
return ['ok' => true];
}
public function userDeactivated(array $user): array
{
$this->notifier->notifyUser((int) ($user['id'] ?? 0), 'Account Deactivated', 'Your account has been deactivated by the administrator.', ['in_app', 'email'], 'notifications', 'parent');
return ['ok' => true];
}
@@ -120,6 +123,7 @@ class AccountEventService
foreach ((array) ($data['students'] ?? []) as $student) {
$this->notifier->notifyUser((int) ($student['id'] ?? 0), 'New Score Available', 'A new score has been posted.', ['in_app', 'email'], 'registration', 'student');
}
return ['ok' => true];
}
@@ -136,21 +140,24 @@ class AccountEventService
public function studentMarkedAbsent(array $record): array
{
$msg = (string) ($record['student_name'] ?? 'Student') . ' was absent on ' . (string) ($record['date'] ?? '');
$msg = (string) ($record['student_name'] ?? 'Student').' was absent on '.(string) ($record['date'] ?? '');
$this->notifier->notifyUser((int) ($record['parent_id'] ?? 0), 'Absence Notification', $msg, ['in_app', 'email'], 'registration', 'parent');
return ['ok' => true];
}
public function studentMarkedLate(array $record): array
{
$msg = (string) ($record['student_name'] ?? 'Student') . ' was late on ' . (string) ($record['date'] ?? '');
$msg = (string) ($record['student_name'] ?? 'Student').' was late on '.(string) ($record['date'] ?? '');
$this->notifier->notifyUser((int) ($record['parent_id'] ?? 0), 'Late Notification', $msg, ['in_app', 'email'], 'registration', 'parent');
return ['ok' => true];
}
public function paymentMissed(array $user): array
{
$this->notifier->notifyUser((int) ($user['id'] ?? 0), 'Payment Missed', 'You have missed a scheduled payment. Please settle your balance.', ['in_app', 'email'], 'payment', 'parent');
return ['ok' => true];
}
@@ -159,13 +166,15 @@ class AccountEventService
foreach ((array) ($data['students'] ?? []) as $student) {
$this->notifier->notifyUser((int) ($student['id'] ?? 0), 'Schedule Update', 'Your class schedule has been updated.', ['in_app'], 'notifications', 'student');
}
return ['ok' => true];
}
public function newMessageReceived(array $data): array
{
$msg = 'You have a new message from ' . (string) ($data['sender_name'] ?? '');
$msg = 'You have a new message from '.(string) ($data['sender_name'] ?? '');
$this->notifier->notifyUser((int) ($data['recipient_id'] ?? 0), 'New Message Received', $msg, ['in_app'], 'notifications', 'parent');
return ['ok' => true];
}
@@ -180,6 +189,7 @@ class AccountEventService
foreach ($users as $user) {
$this->notifier->notifyUser((int) ($user['id'] ?? 0), (string) ($data['title'] ?? ''), (string) ($data['message'] ?? ''), ['in_app'], 'notifications', $targetGroup);
}
return ['ok' => true];
}
@@ -205,10 +215,10 @@ class AccountEventService
}
DB::transaction(function () use ($userData, $userId): void {
$familyCode = 'FAM-' . $userId;
$familyCode = 'FAM-'.$userId;
$family = Family::query()->where('family_code', $familyCode)->first();
if (!$family) {
$householdName = trim('Family of ' . ((string) ($userData['firstname'] ?? '') . ' ' . (string) ($userData['lastname'] ?? '')));
if (! $family) {
$householdName = trim('Family of '.((string) ($userData['firstname'] ?? '').' '.(string) ($userData['lastname'] ?? '')));
$family = Family::query()->create([
'family_code' => $familyCode,
'household_name' => $householdName,
@@ -252,12 +262,12 @@ class AccountEventService
{
try {
$currentYear = (string) Configuration::getConfigValueByKey('school_year');
if (!preg_match('/^(\d{4})-(\d{4})$/', $currentYear, $m)) {
if (! preg_match('/^(\d{4})-(\d{4})$/', $currentYear, $m)) {
return;
}
$y1 = (int) $m[1];
$y2 = (int) $m[2];
$nextYear = ($y1 + 1) . '-' . ($y2 + 1);
$nextYear = ($y1 + 1).'-'.($y2 + 1);
$rows = DB::table('students as s')
->select('s.id as student_id', 'sc.class_section_id', 'fall.semester_score as fall_score', 'spring.semester_score as spring_score')
@@ -309,7 +319,7 @@ class AccountEventService
]);
}
} catch (\Throwable $e) {
Log::error('Promotion queue build failed: ' . $e->getMessage());
Log::error('Promotion queue build failed: '.$e->getMessage());
}
}
@@ -317,6 +327,6 @@ class AccountEventService
{
Log::debug('Skipping Blade email template', ['view' => $viewName]);
return '<p>' . e($fallbackTitle) . '</p>';
return '<p>'.e($fallbackTitle).'</p>';
}
}