[Vuejs]-I want to update 'points' field value in Customer table but it is throwing error as Column not found: 1054 Unknown column 'points' in 'field list'

1👍

Your issue is with your update statement:

Customer::where('id', Auth::user('customer')->id)->update(array('points' => $total_sikka));

You are trying to update the customers table and it doesn’t have the points column. Also, I don’t see the column points in your migration so it seems like its not there.

But I saw that you have points in the user! and I think you are trying to update the user rather than the customer.

In that case you simply need to update your user:

//Customer::where('id', Auth::user('customer')->id)->update(array('points' => $total_sikka));

//Add this instead to update the user directly;
$user->update(['points' => $total_sikka]);

Because I saw that you are also getting the points using the user:

$previousSikka = $user->points; //For getting previous all sikka

Leave a comment