In this section, I will start to build the search page. To being with, we will add a search bar, and then I will show how to add a form that uses GET
to query the API to get comics once the user clicks Search. In a later recipe we will convert this to Angular.
The previous two recipes got us going with a home page and a message area, and now we are set to add a form to that page and update the controller.
First, we are going to give our route a name, so update your
routes.php
file:Now, when you run
php artisan route:list
, you will seehome
as a name:Now we will use that route name for our form in the
resources/views/home
folder addresources/views/home/_search.blade.php
.Now let's update our home index page to show all this at:
resources/views/home/index.blade.php
:Now let's make the Search button do some work! First, update the
HomeController
atapp/Http/Controllers/HomeController.php...