Home > Net >  Laravel Default Value for Decimal Column Type
Laravel Default Value for Decimal Column Type

Time:11-03

I'm trying to set a default value for a decimal column. But I still received a "Not null violation error".

What I have tried:

  1. default('0')
  2. default(0)
  3. default('0.00') (Migration file

    Not null violation error

    CodePudding user response:

    try this

    $table->decimal('exit_fee', 19, 2)->default('00000000000000000.00');
    

    and run migrate will see

    https://i.stack.imgur.com/k8NQF.png

    CodePudding user response:

    I saw this in a different question wich kind of resembles your question.

    $table->decimal('exit_fee', 19, 2)->default('00000000000000000');
    
  • Related