Answer the question
In order to leave comments, you need to log in
Why doesn't Eloquent ORM want to update the model?
Good afternoon!
Laravel 5.3 does not want to update the eloquent model, while creating new ones with a bang! I wrote $fillable in the model, the result is the same. The debug went through the fields, the value was set to the right one, there were no errors when calling save () .. What am I doing wrong?
try {
\DB::beginTransaction();
/** @var vpStore $store */
$store = vpStore::findOrFail($request->store);
$date = new Carbon($request->date);
$totalQty = (int) $store->Qty;
$qty = (int) $request->qty;
/** @var vpReport $report */
$report = new vpReport();
$report->StoreId = $store->Id;
$report->Price = 0;
$report->Qty = $qty;
$report->Date = $date->format('Y-m-d H:i:s');
$report->Type = vpReport::TYPE_CASH;
$report->save();
$store->Qty = $totalQty - $qty;
$store->save();
\DB::commit();
} catch (QueryException $e) {
\DB::rollBack();
}
Answer the question
In order to leave comments, you need to log in
DB::enableQueryLog();
DB::getQueryLog();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question