samedi 29 septembre 2018

Laravel Save Method Isn't Updating Record

In one of my controllers, I am needing to update a specific record in another table. I have code to find the table, update the specific column, and save it. My problem is that the record is never updated. I have ensured that the column is fillable.

Here is the code that is giving me problems:

$portfolio = Portfolios::where('id', $request->portfolioID)->first();
$portfolio->totalValue = $portfolio->totalValue + $cd->currValue;
//dd($portfolio);
$portfolio->save(); 

At the die and dump that is commented out, I can compare the attributes shows the correct value and the original value was the previous value, which is still retained after the save.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire