Second Step: The Controller
In your Controller’s index() function we will get the additional parameter in the URL.
public function index()
$search = \Request::get('search'); //<-- we use global request to get the param of URI
$offices = Office::where('name','like','%'.$search.'%')
We will get the param by assigning \Request::get() method to a variable. After which, we search through our model, the example uses LIKE operator but you can use any of the operators you want. If record found, then display results back to our view.
That’s it, pretty simple.