fix bug column text is can't have default value

This commit is contained in:
Geriano
2022-10-14 07:58:04 +07:00
parent 46fba12a92
commit 9a7a0d504f
2 changed files with 18 additions and 1 deletions

View File

@@ -106,4 +106,19 @@ class Menu extends Model
get: fn () => $this->counter_handler ? new $this->counter_handler : null, get: fn () => $this->counter_handler ? new $this->counter_handler : null,
); );
} }
/**
* @inheritdoc
*/
public static function boot()
{
parent::boot();
static::bootTraits();
static::creating(function (Menu $menu) {
if (empty($menu->actives)) {
$menu->actives = [];
}
});
}
} }

View File

@@ -27,7 +27,9 @@ return new class extends Migration
$table->unsignedTinyInteger('position'); $table->unsignedTinyInteger('position');
$table->boolean('enable')->default(true); $table->boolean('enable')->default(true);
$table->boolean('deleteable')->default(true); $table->boolean('deleteable')->default(true);
$table->longText('actives')->default('[]'); $table->longText('actives')
->nullable()
->default(null);
$table->timestamps(); $table->timestamps();
$table->foreign('parent_id') $table->foreign('parent_id')