false, 'is_active' => true, ]; protected function casts(): array { return [ 'secret' => 'encrypted', 'events' => 'array', 'include_personal_data' => 'boolean', 'is_active' => 'boolean', 'last_delivered_at' => 'datetime', ]; } /** * @return HasMany */ public function deliveries(): HasMany { return $this->hasMany(WebhookDelivery::class)->latest('id'); } public function listensTo(string $event): bool { $events = $this->events ?? []; return in_array('*', $events, true) || in_array($event, $events, true); } /** * @param Builder<$this> $query * @return Builder<$this> */ public function scopeActive(Builder $query): Builder { return $query->where('is_active', true); } }