Skip to content

Commit a43066a

Browse files
committed
bugfix: cannot delete language
1 parent 6d886ee commit a43066a

File tree

1 file changed

+2
-22
lines changed

1 file changed

+2
-22
lines changed

src/Observers/LanguageObserver.php

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function saving($model)
3535
*/
3636
public function updating($model)
3737
{
38-
$this->updateRelatedContentRoutes($model);
38+
//
3939
}
4040

4141
/**
@@ -76,26 +76,6 @@ protected function clearCached()
7676
*/
7777
protected function deleteRelatedModels($model)
7878
{
79-
$model->contentSegments()->delete();
80-
}
81-
82-
/**
83-
* @param Language&Model $model
84-
* @return void
85-
*/
86-
protected function updateRelatedContentRoutes($model)
87-
{
88-
if (! $model->isDirty(['code'])) {
89-
return;
90-
}
91-
92-
$oldCode = $model->getOriginal('code');
93-
$newCode = $model->code;
94-
95-
$contentRouteModel = $model->contentSegments()->getRelated();
96-
97-
$contentRouteModel->newQuery()
98-
->where('locale', $oldCode)
99-
->update(['locale' => $newCode]);
79+
$model->contentRoutes()->delete();
10080
}
10181
}

0 commit comments

Comments
 (0)