Hi, I'm currently developing a web project
And trying to implement the finish status to set the status into finish once the booking has been paid. When the finish button is created, the status won't change. How do i resolve this problem??
The Controller :
public function finish($id){
$booking = Booking::find($id);
$booking->status = 'Finish';
$booking->save();
return redirect()->back();
}
@Lumethys So what i want is, that when the customer(the user) is already paid the booking, the customer enjoy the holiday package that they're ordered, after that the vendor(admin) can set the booking status from paid to finish, and send an email to the customer that recently just enjoyed his holiday package and give a review about their experienced
create a schedule, everyday it would check the Booking table:
$bookings = Booking::where('stattus', 'paid')->get();
foreach($bookings as $booking){
$endDate = Carbon::parse($booking->end);
$now = Carbon::now();
if ($now->greaterThan($endDate)){ // if today is greater than the booking's last day
Mail::to($booking->client())->send(new SomeThankYouEMail($booking));
$booking->status = 'finished'
$booking->save();
}
}
they will recieve an email that tell them the booking is finished
Who will send this email? the User? Impractical. If your user forgot to mail you, will the status never change? If your app had 5 000 user per day, do your admin need to manually check 5000 box per day?
Automate this process, when someone Book a trip, they must have a start day and an end date, no?
"I want to book a trip to Venice from 12/10/2022 to 20/10/2022" or something like that.