I have a table named advertisments which has views column. I want to fetch the data from advertisments table and increment each row's views in a single query is it possible ?.
The following code is what I wrote to achieve the desired result but the views aren't updating.
Advertisement::with('sponsor')
->whereDeleted(false)
->whereHeader(false)
->orderBy('views')
->raw("update views ".DB::raw('views + 1'))
->get();
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire