php - Increment columns in laravel -
is there way increment more 1 column in laravel?
let's say:
db::table('my_table') ->where('rowid', 1) ->increment('column1', 2) ->increment('column2', 10) ->increment('column3', 13) ->increment('column4', 5);
but results to:
call member function increment() on integer
i want find efficient way using given functions laravel. thanks. suggestions do.
there no existing function this. have use update()
:
db::table('my_table') ->where('rowid', 1) ->update([ 'column1' => db::raw('column1 + 2'), 'column2' => db::raw('column2 + 10'), 'column3' => db::raw('column3 + 13'), 'column4' => db::raw('column4 + 5'), ]);