title: Use Controller Laravel 8 Variable value for Mysql Stored Procedure
body: <p>I have stored procedure query for calculate Distance..
  But, i have dummy value for latitude and longitude in Controller Laravel 8..</p>
  <p>Here's my Contoller:</p>
  <pre><code> public function index(Request $request)
  {
      $latitude = &quot;-6.190054983260954&quot;;
      $longitude = &quot;106.79885292237778&quot;;
  
      $cities = City::all();
      $city = $request-&gt;get('city_name');
      $search = $request-&gt;get('keyword');
  
      $getDistance = DB::select('CALL home_search(' . $city . ', ' . $search . ')');
  
      return view('pages.index', [
          'getDistance' =&gt; $getDistance,
      ]);
  }
  </code></pre>
  <p>Here's mysql Stored Procedure:</p>
  <pre><code>CREATE PROCEDURE `home_search` ()
  BEGIN
  SELECT * FROM pharmacies, cities , SQRT(POW(($latitude - pharmacy_lat ), 2) +
          POW(($longitude - pharmacy_long), 2)) * 111.319 AS distance
          WHERE city = $city AND city_address LIKE '%VALUE_FROM_SEARCH_IN_LARAVEL%'
          ORDER BY distance, asc 
          LIMIT 3
  END
  </code></pre>
  <p>Do you know how to add laravel controller variable's value for be used to my stored procedure query?</p>