I think it should be
$table->decimal('price', 15, 2)->default(0.00);
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I'm having issues setting the default value of a column in my migration file.
Migration:
$table->decimal('price', 15, 2)->default(0);
Model:
protected $fillable = ['product_id', 'option_id', 'option_value_id', 'price', 'price_prefix', 'weight', 'weight_prefix', 'sku'];
I can definitely see that the default value is there in my Sequel Pro database. But I still receive the error shown in the title when not giving a value.
I'm using Laravel 8.5.0
Any ideas?
Please or to participate in this conversation.