Various code cleanup and sorting.

This commit is contained in:
James Cole
2025-03-08 19:55:21 +01:00
parent 2d3d3bc0a4
commit 30b7e17b6f
60 changed files with 1402 additions and 1475 deletions

View File

@@ -67,23 +67,21 @@ class WebhookRepository implements WebhookRepositoryInterface, UserGroupInterfac
public function getMessages(Webhook $webhook): Collection
{
return $webhook->webhookMessages()
->orderBy('created_at', 'DESC')
->get(['webhook_messages.*'])
;
->orderBy('created_at', 'DESC')
->get(['webhook_messages.*']);
}
public function getReadyMessages(Webhook $webhook): Collection
{
return $webhook->webhookMessages()
->where('webhook_messages.sent', 0)
->where('webhook_messages.errored', 0)
->get(['webhook_messages.*'])
->filter(
static function (WebhookMessage $message) { // @phpstan-ignore-line
return $message->webhookAttempts()->count() <= 2;
}
)->splice(0, 3)
;
->where('webhook_messages.sent', 0)
->where('webhook_messages.errored', 0)
->get(['webhook_messages.*'])
->filter(
static function (WebhookMessage $message) { // @phpstan-ignore-line
return $message->webhookAttempts()->count() <= 2;
}
)->splice(0, 3);
}
public function store(array $data): Webhook