title: Search bar in Laravel 5.3 to filter the table
body: <p>1) I added the search bar to the view :</p>
  
  <pre><code>{!! Form::open(['method'=&gt;'GET','url'=&gt;'home','class'=&gt;'navbar-form navbar-left','role'=&gt;'search'])  !!}
  
              &lt;div class="input-group custom-search-form"&gt;
                  &lt;input type="text" class="form-control" name="search" placeholder="Search..."&gt;
                  &lt;span class="input-group-btn"&gt;
      &lt;button class="btn btn-default-sm" type="submit"&gt;
          &lt;i class="fa fa-search"&gt;i
      &lt;/button&gt;
  &lt;/span&gt;
  </code></pre>
  
  <p>  </p>
  
  <p>2) In my controller I'm displaying all my users in a table and the search bar is on top of it</p>
  
  <pre><code>public function index()
  {
      $user = User::all();
  
      $search = \Request::get('search');  the param of URI
  
      $users = User::where('name','=','%'.$search.'%')
          -&gt;orderBy('name')
          -&gt;paginate(20);
  
      return view('home',compact('users'))-&gt;withuser($user);
  
  }
  </code></pre>
  
  <p>Here is what the table looks like </p>
  
  <pre><code> @foreach($user as $users)
                      &lt;th scope="row"&gt;1&lt;/th&gt;
                       &lt;td&gt;&lt;a href="{{ url('/user').'/'.$users-&gt;id }}"&gt;show&lt;/a&gt;&lt;/td&gt;
                        &lt;td&gt;{{$users-&gt;name}}&lt;/td&gt;
                      &lt;td&gt;{{$users-&gt;city}}&lt;/td&gt;
                      &lt;td&gt;{{$users-&gt;phone}}&lt;/td&gt;
                      &lt;td&gt;{{$users-&gt;street}}&lt;/td&gt;
                      &lt;td&gt;{{$users-&gt;national_id}}&lt;/td&gt;
                      &lt;td&gt;{{$users-&gt;name}}&lt;/td&gt;
  
                  &lt;/tr&gt;
       @endforeach
  </code></pre>
  
  <p>What I'm trying to get is when I search in the bar I want to do a loop like this 
         @foreach($users as $user)
             
              {{ $user->name }}
              
          @endforeach
  and replace the view to the searched names only. 
  and here is the route for the index </p>
  
  <pre><code>    Route::get('/home', 'HomeController@index');
  </code></pre>
  
  <p>how can I achive that ? sorry for the long question in advance. </p>