Fix Pint formatting

This commit is contained in:
root
2026-06-09 01:25:14 -04:00
parent 6be4875c5e
commit 20a0b6c4e5
1485 changed files with 11318 additions and 10273 deletions
@@ -10,18 +10,16 @@ use RuntimeException;
class MessageCommandService
{
public function __construct(private GlobalConfigService $configService)
{
}
public function __construct(private GlobalConfigService $configService) {}
public function create(int $senderId, array $payload, ?UploadedFile $attachment = null): Message
{
$recipientId = $payload['recipient_id'] ?? null;
if (!$recipientId && !empty($payload['recipient_role'])) {
if (! $recipientId && ! empty($payload['recipient_role'])) {
$recipientId = $this->recipientIdFromRole($payload['recipient_role']);
}
if (!$recipientId) {
if (! $recipientId) {
throw new RuntimeException('Recipient is required.');
}
@@ -42,7 +40,7 @@ class MessageCommandService
'message' => (string) $payload['message'],
'sent_datetime' => now(),
'read_status' => 0,
'message_number' => 'MSG-' . now()->format('YmdHis'),
'message_number' => 'MSG-'.now()->format('YmdHis'),
'priority' => $payload['priority'] ?? 'normal',
'attachment' => $path,
'status' => $payload['status'] ?? 'sent',
@@ -50,7 +48,7 @@ class MessageCommandService
'school_year' => $payload['school_year'] ?? $this->configService->getSchoolYear() ?? '',
]);
if (!$message) {
if (! $message) {
throw new RuntimeException('Failed to send message.');
}
@@ -76,7 +74,7 @@ class MessageCommandService
}
}
if (!empty($updates)) {
if (! empty($updates)) {
$message->fill($updates);
$message->save();
}
@@ -89,6 +87,7 @@ class MessageCommandService
{
return DB::transaction(function () use ($message) {
$message->status = 'trashed';
return (bool) $message->save();
});
}
@@ -117,7 +116,7 @@ class MessageCommandService
];
$key = strtolower(trim($roleName));
if (!isset($map[$key])) {
if (! isset($map[$key])) {
throw new RuntimeException('Invalid recipient role.');
}
@@ -11,11 +11,12 @@ class MessageQueryService
public function getUserRoleName(int $userId): ?string
{
$user = User::query()->with('roles')->find($userId);
if (!$user) {
if (! $user) {
return null;
}
$role = $user->roles->sortBy('id')->first();
return $role ? (string) $role->name : null;
}
@@ -67,7 +68,7 @@ class MessageQueryService
->pluck('id')
->all();
if (!empty($ids)) {
if (! empty($ids)) {
Message::query()
->whereIn('id', $ids)
->update([
@@ -90,7 +91,7 @@ class MessageQueryService
{
$query = Message::query()->with(['sender', 'recipient']);
if (!empty($filters['priority'])) {
if (! empty($filters['priority'])) {
$query->where('priority', $filters['priority']);
}
@@ -98,8 +99,8 @@ class MessageQueryService
$query->where('read_status', (int) $filters['read_status']);
}
if (!empty($filters['search'])) {
$term = '%' . $filters['search'] . '%';
if (! empty($filters['search'])) {
$term = '%'.$filters['search'].'%';
$query->where(function ($q) use ($term) {
$q->where('subject', 'like', $term)
->orWhere('message', 'like', $term);
@@ -22,7 +22,7 @@ class MessageRecipientService
return $rows
->map(fn ($row) => [
'id' => (int) $row->teacher_id,
'name' => trim($row->firstname . ' ' . $row->lastname),
'name' => trim($row->firstname.' '.$row->lastname),
])
->unique('id')
->values()
@@ -81,7 +81,7 @@ class MessageRecipientService
return $users
->map(fn ($row) => [
'id' => (int) $row->id,
'name' => trim($row->firstname . ' ' . $row->lastname),
'name' => trim($row->firstname.' '.$row->lastname),
])
->unique('id')
->values()