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
@@ -9,14 +9,12 @@ use Illuminate\Support\Facades\Log;
class DeleteUnverifiedUserService
{
public function __construct(private AccountEventService $accountEvents)
{
}
public function __construct(private AccountEventService $accountEvents) {}
public function deleteAfterTimeout(int $userId, int $timeoutSeconds = 86400): array
{
$user = User::query()->find($userId);
if (!$user) {
if (! $user) {
return ['ok' => false, 'reason' => 'not_found'];
}
@@ -25,7 +23,7 @@ class DeleteUnverifiedUserService
}
$lastActivity = $user->updated_at ?? $user->created_at;
if (!$lastActivity) {
if (! $lastActivity) {
return ['ok' => false, 'reason' => 'no_timestamp'];
}
@@ -21,6 +21,7 @@ class InactiveUserCleanupService
if (empty($users)) {
$orphans = $this->purgeOrphanedUserRoles();
return [
'deleted_users' => 0,
'deleted_parents' => 0,
+5 -6
View File
@@ -7,24 +7,23 @@ use Illuminate\Support\Facades\Log;
class UserEventService
{
public function __construct(private EmailService $emailService)
{
}
public function __construct(private EmailService $emailService) {}
public function handleNewAccountAdded(array $userData): bool
{
$email = (string) ($userData['email'] ?? '');
if ($email === '') {
Log::warning('UserEventService: missing email for welcome message.');
return false;
}
$name = trim((string) (($userData['firstname'] ?? '') . ' ' . ($userData['lastname'] ?? '')));
$name = trim((string) (($userData['firstname'] ?? '').' '.($userData['lastname'] ?? '')));
$safeName = e($name !== '' ? $name : 'there');
$subject = 'Welcome to Al Rahma Sunday School!';
$message = '<p>Hello ' . $safeName . ',</p>'
. '<p>Your account has been created. Welcome to Al Rahma Sunday School.</p>';
$message = '<p>Hello '.$safeName.',</p>'
.'<p>Your account has been created. Welcome to Al Rahma Sunday School.</p>';
return $this->emailService->send($email, $subject, $message, 'registration');
}
+4 -4
View File
@@ -40,11 +40,11 @@ class UserListService
$parentType = $guardianMap[$userId] ?? '';
$isSecond = false;
if ($userId > 0 && !empty($secondByUserId[$userId])) {
if ($userId > 0 && ! empty($secondByUserId[$userId])) {
$isSecond = true;
} else {
$email = trim(strtolower((string) $user->email));
if ($email !== '' && !empty($secondByEmail[$email])) {
if ($email !== '' && ! empty($secondByEmail[$email])) {
$isSecond = true;
}
}
@@ -91,7 +91,7 @@ class UserListService
private function guardianTypeMap(): array
{
if (!Schema::hasTable('family_guardians')) {
if (! Schema::hasTable('family_guardians')) {
return [];
}
@@ -119,7 +119,7 @@ class UserListService
private function secondParentMaps(): array
{
if (!Schema::hasTable('parents')) {
if (! Schema::hasTable('parents')) {
return [[], []];
}
+11 -11
View File
@@ -12,9 +12,7 @@ use Illuminate\Support\Facades\Validator;
class UserManagementService
{
public function __construct(private UserEventService $eventService)
{
}
public function __construct(private UserEventService $eventService) {}
public function create(array $payload, ?int $actorId = null): array
{
@@ -45,7 +43,7 @@ class UserManagementService
public function update(int $userId, array $payload): array
{
$user = User::query()->find($userId);
if (!$user) {
if (! $user) {
return ['ok' => false, 'message' => 'User not found.'];
}
@@ -67,7 +65,7 @@ class UserManagementService
public function delete(int $userId): array
{
$user = User::query()->find($userId);
if (!$user) {
if (! $user) {
return ['ok' => false, 'message' => 'User not found.'];
}
@@ -87,11 +85,11 @@ class UserManagementService
{
$actorId = $actorId ?? (auth()->id() ?? null);
if (!User::query()->whereKey($userId)->exists()) {
if (! User::query()->whereKey($userId)->exists()) {
return false;
}
if (!Role::query()->whereKey($roleId)->exists()) {
if (! Role::query()->whereKey($roleId)->exists()) {
return false;
}
@@ -133,10 +131,10 @@ class UserManagementService
'accept_school_policy' => ['required'],
];
$isParent = !empty($data['is_parent']);
$noSecondParent = !empty($data['no_second_parent_info']);
$isParent = ! empty($data['is_parent']);
$noSecondParent = ! empty($data['no_second_parent_info']);
if ($isParent && !$noSecondParent) {
if ($isParent && ! $noSecondParent) {
$rules += [
'second_firstname' => ['required', 'regex:/^[a-zA-Z\\s\\-]+$/', 'min:2', 'max:30'],
'second_lastname' => ['required', 'regex:/^[a-zA-Z\\s\\-]+$/', 'min:2', 'max:30'],
@@ -215,7 +213,7 @@ class UserManagementService
];
foreach ($map as $field) {
if (!array_key_exists($field, $payload)) {
if (! array_key_exists($field, $payload)) {
continue;
}
@@ -265,6 +263,7 @@ class UserManagementService
if ($value === 'female') {
return 'Female';
}
return null;
}
@@ -274,6 +273,7 @@ class UserManagementService
if ($value === '') {
return '';
}
return ucfirst($value);
}