php - How to increment and update column in one eloquent query -


is possible update timestamp (besides updated_at) , increment column in 1 query? can ->increment('count') , separately ->update(['last_count_increased_at' => carbon::now()]) there easy way both together.

product::where('product_id', $product->id) ->update(['count'=>count+1, 'last_count_increased_at' => carbon::now()];

without having query , count first?

this untested, can use db::raw method:

product::where('product_id', $product->id) ->update(['count'=>db::raw('count+1'), 'last_count_increased_at' => carbon::now()];