Reputation: 11
I used this query to update the status column.
$val="1";
vehicles::where('id' , '=' , $veh_status)->update(['status' => $val]);
But when I submitted the status value doesn't change.
Upvotes: 1
Views: 1091
Reputation: 552
Not sure what the problem is there because you haven't given much info to work with, but you can check these suggestions:
where()
function is valid.Try using another function, save()
which will achieve the same results you seek, like this;
// filter the vehicle
$vehicle = vehicles::where('id', '=', $veh_id)->first();
or
$vehicle = vehicles::find($veh_id);
$vehicle->status = 1;
$vehicle->save();
Lastly, I noticed your id variable you pass to the where the () function is called $veh_status
"presumably - vehicle status" and not $veh_id
, "presumably - vehicle id" so probably check that out.
Ref: Laravel Model Update documentation
Upvotes: 1
Reputation: 308
you can trace your query by using ->toSql()
method !
try this to find whats happening in back
Upvotes: 1