Skip to content

Commit 5cd7cfe

Browse files
committed
remove override
1 parent 826c009 commit 5cd7cfe

File tree

1 file changed

+1
-63
lines changed

1 file changed

+1
-63
lines changed

src/app/Models/Traits/SpatieTranslatable/SluggableObserver.php

Lines changed: 1 addition & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,6 @@
77

88
class SluggableObserver extends \Cviebrock\EloquentSluggable\SluggableObserver
99
{
10-
/**
11-
* @var \Cviebrock\EloquentSluggable\Services\SlugService
12-
*/
13-
private $slugService;
14-
15-
/**
16-
* @var \Illuminate\Contracts\Events\Dispatcher
17-
*/
18-
private $events;
1910

2011
/**
2112
* SluggableObserver constructor.
@@ -25,60 +16,7 @@ class SluggableObserver extends \Cviebrock\EloquentSluggable\SluggableObserver
2516
*/
2617
public function __construct(SlugService $slugService, Dispatcher $events)
2718
{
28-
$this->slugService = $slugService;
29-
$this->events = $events;
30-
}
31-
32-
/**
33-
* @param \Illuminate\Database\Eloquent\Model $model
34-
*
35-
* @return bool|null
36-
*/
37-
public function saving(Model $model)
38-
{
39-
return $this->generateSlug($model, 'saving');
19+
parent::__construct($slugService, $events);
4020
}
4121

42-
/**
43-
* @param \Illuminate\Database\Eloquent\Model $model
44-
* @param string $event
45-
*
46-
* @return bool|null
47-
*/
48-
protected function generateSlug(Model $model, string $event): void
49-
{
50-
// If the "slugging" event returns a value, abort
51-
if ($this->fireSluggingEvent($model, $event) !== null) {
52-
return;
53-
}
54-
$wasSlugged = $this->slugService->slug($model);
55-
56-
$this->fireSluggedEvent($model, $wasSlugged);
57-
}
58-
59-
/**
60-
* Fire the namespaced validating event.
61-
*
62-
* @param \Illuminate\Database\Eloquent\Model $model
63-
* @param string $event
64-
*
65-
* @return mixed
66-
*/
67-
protected function fireSluggingEvent(Model $model, string $event): ?array
68-
{
69-
return $this->events->until('eloquent.slugging: '.get_class($model), [$model, $event]);
70-
}
71-
72-
/**
73-
* Fire the namespaced post-validation event.
74-
*
75-
* @param \Illuminate\Database\Eloquent\Model $model
76-
* @param string $status
77-
*
78-
* @return void
79-
*/
80-
protected function fireSluggedEvent(Model $model, string $status): void
81-
{
82-
$this->events->dispatch('eloquent.slugged: '.get_class($model), [$model, $status]);
83-
}
8422
}

0 commit comments

Comments
 (0)