Skip to content
Shipu Ahamed edited this page Sep 3, 2016 · 1 revision

onUpdate

By default, updating a model will not try and generate a new slug value. It is assumed that once your slug is generated, you won't want it to change (this may be especially true if you are using slugs for URLs and don't want to mess up your SEO mojo).

If you want to regenerate one or more of your model's slug fields, you can set those fields to null or an empty string before the update:

$post->slug = null;
$post->update(['title' => 'My New Title']);

If this is the behaviour you want every time you update a model, then set the onUpdate option to true.

Clone this wiki locally