I
I
Ivan Ivanov2019-04-28 15:36:45
Laravel
Ivan Ivanov, 2019-04-28 15:36:45

How to make the slug update when a post is updated?

When creating a slug, everything is OK, it works, etc., but when updating the slug, it does not change. How to fix? Laravel 5.8 (I guess it doesn't matter)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Razgelday, 2019-08-21
@Razgelday

I would use Eloquent Events ( https://laravel.com/docs/5.8/eloquent#events). I would hang a listener on the PostUpdated
event that would generate a new slug.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question