Laravel 5 simple search box using GET method

Second Step: Add the Search Box

Since we will be going to incorporate our search box in the index.blade.php we will going to add it to it.

 

If you want to reuse our search box to other pages, you can do something like below, and save it as search.blade.php

We converted our text parameters into variables, then in every index.blade.php we include it, and add some variables that should be same name to the variable of the search box. So in your index, include the following code.

This will reuse the search.blade.php by including it to every index.blade.php you have.

Note: This may not exact solution for nested URI segments.

In this stage we will test our search and you should get something like below.

the search box4

here, we searched for an office name BAC. Since we are using GET method, you should have the ?search=BAC params in your URL.

Sharing is caring!