fix: 🐛 set id_key from slug or title when the dynamic page is root
This commit is contained in:
parent
368d3d0b40
commit
6957fd78f0
1 changed files with 4 additions and 1 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue