In this episode, we're focusing on what happens after a user successfully books an appointment — how do we redirect them to a proper confirmation page? We'll walk through building out a simple confirmation controller and setting up a new route that uses the appointment's UUID to show relevant details on this page.
To demonstrate, we'll make a booking, fetch its UUID, and test navigating to the confirmation page. Then we update our appointment controller so that when a booking is made, it returns a JSON response with the URL for the confirmation page. On the frontend, as soon as we get this response, we simply redirect the user to that confirmation URL using window.location
. It's not fancy, but it gets the job done without needing to do a standard Laravel redirect.
By the end of the episode, we'll have everything working so that after an appointment is booked, users are sent straight to their brand new confirmation page. In the next episode, we'll actually build out the content of that page!