In this episode, we're making the employee
parameter optional throughout our booking flow. First, we update our web routes and add a question mark after employee
to let Laravel know this route parameter doesn't have to be present. This change means we can visit the checkout page without always specifying an employee up front.
After updating the routes, we move on to the checkout logic, making sure it handles a null
employee without any errors. Next, on the homepage, we tweak our link to the checkout so it doesn't need to pass an employee anymore—just the service when that's all we've got.
We do a quick test, fix a small bug where we were passing the wrong variable, and confirm that everything now works whether or not there’s an employee selected. Lastly, we tidy up our template: we show either a placeholder or the employee details depending on whether an employee is set, using simple if
statements. Now, users can start their booking with just a service, and the app takes care of the rest as they go.