Level 102
Booking::where('email', '=', \Auth::user()->email)->update($arrayOfUpdateData);
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi, how can I update many bookings in one method? I'm finding bookings where email is the same as logged in user and I want to add the id of that user into user_id column.
I tried $bookings->save(), but that didn't work. Any ideas?
public function getBookings()
{
$bookings = Booking::where('email', '=', \Auth::user()->email)->get();
if (request()->wantsJson()) {
return $bookings;
}
return $bookings;
}
What would you like to update? Lets say you want to change the statuscolumn to 0
Booking::where('email', '=', \Auth::user()->email)->update(['status' => 0]);
Please or to participate in this conversation.