nae
1 month ago
533
1
Laravel

Change status after insterting

Posted 1 month ago by nae

Hi. How change status from 1 to 0 in table seats when i do reservation and choose a seat from this table and insert in table booking?

All the seats is in a separate table. I call this seats with ajax when choose the date for trip. All the seats show depend what date i choose.This is in view.

public function bookingForm ( Request $request){

foreach ($request->addperson as $key => $value) {

BookingNow::create([
'route_id' => $value['route_id'],
 'user_id'=>  $user_id = auth()->user()->id,
  'name' => $value['name'],
  'description' => $value['description'],
  'seat_no' => $value['seat_no'],
  'phone' => $value['phone'],
  'email' => $value['email'],
  'date' => $value['date'],
  'hour' => $value['hour'],
  'stationroute' => $value['stationroute'],
  'pricestation' => $value['pricestation'],
 ]);

}

    Session::flash('success','Rezervarea a fost adaugat cu success');
    return redirect()->back();
}

Please sign in or create an account to participate in this conversation.