laravel search box

Laravel 5 simple search box using GET method

First of all, I know there are many ways to do this, and this might not be the best way to do it.

You can also check this post for advanced search: Laravel 5.x Search Box using jQuery + Ajax

So what we are going to do is to add a search box text field in the upper left side of our table. Definitely it will search for any records containing the word to search. The search box can be reuse in other index as well to make tidy codes.

First Step: Search Box

This is the search box (please never mind the add link, you can remove it if you want). Here, we create a form that will direct to officesController@index. The method we use is GET. The role is the variable you will use in your URI to put the search parameter.

You may put this code in a separate blade and reuse it with other view, OR you can just directly add it in the view below which is the index.

Prev1 / 3

Sharing is caring!