Fix Pint formatting
This commit is contained in:
@@ -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.');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user