From e0fd0f0602817d78db0c45df3ed4b323261d3e82 Mon Sep 17 00:00:00 2001 From: Helge Sverre Date: Thu, 2 Nov 2023 00:54:04 +0100 Subject: [PATCH] Fix: HasSlugAttributeTrait referenced $this when in a static context, changed it to $record --- src/Models/Concerns/HasSlugAttributeTrait.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Models/Concerns/HasSlugAttributeTrait.php b/src/Models/Concerns/HasSlugAttributeTrait.php index 7989f19..9c52acf 100644 --- a/src/Models/Concerns/HasSlugAttributeTrait.php +++ b/src/Models/Concerns/HasSlugAttributeTrait.php @@ -35,12 +35,12 @@ protected static function bootHasSlugAttributeTrait(): void if (! empty($changedSlugs)) { $published = true; - if (method_exists($this, 'isPublishedForDates')) { - $published = $this->isPublishedForDates($this->getOriginal('publishing_begins_at'), $this->getOriginal('publishing_ends_at')); + if (method_exists($record, 'isPublishedForDates')) { + $published = $record->isPublishedForDates($record->getOriginal('publishing_begins_at'), $record->getOriginal('publishing_ends_at')); } //dispatch event: - SlugChanged::dispatch($this, $changedSlugs, $published); + SlugChanged::dispatch($record, $changedSlugs, $published); } }); }