public function destroy($id)
{
$appointments = Booking::find($id);
$appointmentsDelete = $appointments->delete();
Time::where('appointment_id')->where('time')->update(['status'=>0]);
return redirect()->route('my.booking')->with('message', 'Booking deleted successufully');
}
When i delete appointment from table "Booking" i want to update "status" from the table Time to be 0. When i make new appointment and i selected new time status will be 1 and disappear from selectable list. So,
I want it to return to the list by updating status 0.
Status 0 means hours are available. And 1 when someone makes an appointment, and the time is no longer available.
In my case, when i delete appointment, time doesn't return in that list.
@unk Ok, so you have no relationship between the Appointment and the Booking, so that makes the update more difficult... but you can use $booking->time for the second constraint.
public function destroy($id)
{
$appointments = Booking::find($id);
$appointmentsDelete = $appointments->delete();
Time::where('appointment_id') // how can you get the appointment ID?
->where('time', $booking->time)
->update(['status'=>0]);
return redirect()->route('my.booking')->with('message', 'Booking deleted successufully');
}
@unk you have an individual Booking instance; you called it $appointments - my bad using $booking
$appointments = Booking::find($id);
Time::where('appointment_id') // how can you get the appointment ID?
->where('time', $appointments->time)
->update(['status'=>0]);