Fix setting form meta when form has no fields
This commit is contained in:
parent
0bc00207b2
commit
60b0052622
|
@ -140,8 +140,8 @@ class Form extends Model implements HasMedia
|
||||||
static::saving(function (self $model) {
|
static::saving(function (self $model) {
|
||||||
if (is_null($model->meta)) {
|
if (is_null($model->meta)) {
|
||||||
$model->setAttribute('meta', [
|
$model->setAttribute('meta', [
|
||||||
'active_columns' => $model->getFields()->take(4)->pluck('key')->toArray(),
|
'active_columns' => $model->getFields()->count() ? $model->getFields()->take(4)->pluck('key')->toArray() : null,
|
||||||
'sorting' => [$model->getFields()->first()['key'], 'asc'],
|
'sorting' => $model->getFields()->count() ? [$model->getFields()->first()['key'], 'asc'] : null,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue