fix: 🐛 set id_key from slug or title when the dynamic page is root

This commit is contained in:
Alexis Gousseau 2026-01-09 11:02:39 +01:00
parent 368d3d0b40
commit 6957fd78f0

View file

@ -105,7 +105,10 @@ class DynamicPage extends Model implements TranslatableModel
{
static::creating(function (self $model) {
self::manageFields($model);
$model->id_key = $model->slug;
// Set id_key from slug or title when the dynamic page is root.
$model->id_key = isset($model->slug) && !empty($model->slug)
? $model->slug
: Str::slug($model->title);
});
static::updating(function (self $model) {
self::manageFields($model);