Skip to content

Commit

Permalink
fix: type casts
Browse files Browse the repository at this point in the history
  • Loading branch information
go-vehikl committed Nov 7, 2024
1 parent 72208cf commit a99ef6a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/Models/WebhookConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\File;

class WebhookConfiguration extends Model
Expand Down Expand Up @@ -44,11 +45,11 @@ protected static function booted(): void
});

self::deleted(static function (self $webhookConfiguration): void {
self::updateCache(collect($webhookConfiguration->events));
self::updateCache(collect((array) $webhookConfiguration->events));
});
}

private static function updateCache($eventList): void
private static function updateCache(Collection $eventList): void
{
$eventList->each(function (string $event) {
cache()->forever("webhooks.$event", WebhookConfiguration::query()->whereJsonContains('events', $event)->get());
Expand Down

0 comments on commit a99ef6a

Please sign in to comment.