So im making a booking system website (a simple one) using laravel 5.5.
Here's how it goes.
A user access a profile with a form booking inside the profile -> user submitting booking enquiry -> user will get notified by emails with all the booking form data submitted previously
I have successfully achieved in passing all the data to the email but i have trouble passing all the data to the generated "/receipt" view.
What im trying to achieve is a "/receipt" page where the user gets a feedback that the booking enquiry has been submitted. This will only be generated once, so if the user refreshes the page it will be empty.
What i have right now
Controller
$enquiryID = strtoupper(substr(md5(microtime()), 0, 7)) . $user->id;
$bookingEnquiry->id = $enquiryID;
$bookingEnquiry->user_id = $user->id;
$bookingEnquiry->name = $request->input('bookingName');
$bookingEnquiry->phone_number = $request->input('bookingContact');
$bookingEnquiry->email = $request->input('bookingEmail');
session()->flash('message', 'Your booking enquiry has been sent!');
return redirect('/receipt')->with(compact('bookingEnquiry', 'enquiryID', 'user', 'request'));
Route
Route::get('/receipt', function () {
return view('bookingEnquiries.receipt');
});
I'd like to pass name, phone, email to the 'bookingEnquiries.receipt' page once.
Also, can i generate the view inside the controller ? Seems to be a bit neater.