Adding a Button
Learn how we can add a button for adding products to the cart.
We'll cover the following...
Now it’s time to add an “Add to Cart” button for each product.
Using a Scaffold generator
We don’t need to create a new controller (LineItem
) or even a new action. Taking a look at the actions provided by the scaffold generator, we find index()
, show()
, new()
, edit()
, create()
, update()
, and destroy()
. The one that matches this operation is create()
. The new()
action may sound similar, but it is used to get a form that’s used to ...