In this episode, we start to set up (or "scaffold") the orders page for users. Now that orders are associated properly with both guests and authenticated users, we want to create a nice page that lists all the orders a user has placed.
Here’s what we do step-by-step:
OrderIndexController
) and wire up a route to it, making sure the route requires authentication.orders/index.blade.php
view file and paste in some pre-made markup (which you can get from the course downloads).orders
relationship). For now, we just grab the orders, but we’ll do more detailed eager loading soon.formattedSubtotal
method for nice formatting), shipping type, and created date.By the end, the orders page is scaffolded and showing simple order details for the logged-in user. In the next episode, we'll dive into showing product variations attached to each order and work on that order status!