skip to Main Content

I have the following code in a controller file

        $customer->update([
            'name' => $request->input('name'),
            'address' => $request->input('address'),
            'phone' => $request->input('phone'),
            'percentage' => $request->input('percentage')
        ]);

which successfully updates everything except the percentage field which is of type DECIMAL(2,2)
I get no error messages but in my table the percentage value stays the same. I have tried replacing with a hardcoded decimal value to no avail either.

3

Answers


  1. check if you are passing the correct name/id for your data.

    Login or Signup to reply.
  2. You might be forget to add percentage field to fillable in model.

    Check your model.

    protected $fillable = ['your other fields','percentage'];
    

    hope this work for you.

    Login or Signup to reply.
  3. Make sure you have allocated the value size in the column and check if it matches your updated value size

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search