In one of my Laravel
project, I have to update two table's data within a same scope of a function. At first query, I am trying to update data of a table using following query -
DB::table('parameters')
->where($where)
->update($data);
In second and third query I am adding and subtracting two column's of another table -
DB::table('categories')
->where(['id' => $data['category_id']])
->increment('parameters');
DB::table('categories')
->where(['id' => $previous_category_id])
->decrement('parameters');
Everything is working fine. But, now I want to do all these operations within one query execution.