title: How make search web in laravel by ajax
body: <pre><code>&lt;?php
  
  namespace App\Http\Controllers;
  
  use DB;
  use Illuminate\Http\Request;
  
  class SearchController extends Controller
  {
      public function search(Request $request) {
          $text = $request-&gt;input('text');
  
          $patients = DB::table('patients')
                          -&gt;where('firstname', 'Like', $text)
                          -&gt;get();
  
          // return the results
          return response()-&gt;json($patients);
      }
  }
  </code></pre>