Answer the question
In order to leave comments, you need to log in
Is it correct to insert data like this?
You need to change the current data in the line
. I do this:
$this->update([
'total_rates' => DB::raw('total_rates + 1'), // тут еще ладно
'rate_total' => DB::raw('rate_total + ' . $total) // а вот тут у меня вопрос
]);
Answer the question
In order to leave comments, you need to log in
RAW for exceptional cases, otherwise the whole meaning of the builder is lost then.
https://laravel.com/docs/5.6/queries#increment-and...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question