TextInput integer save 0 as null

here is my code

TextInput::make('amount')
                                ->integer()
                                ->minValue(0)
                                ->required()

if user put 0 into it, it saved as null instead of '0'
Solution
public function getAmountAttribute($value)
{
    return $value ?? 0;
}


On your model.
Was this page helpful?