title: Basic rerouting in laravel
body: <p>So I have this route</p>
  
  <pre><code>Route::get('/locations/{lat}/{lng}', ['as'=&gt;'locations.find', 'uses'=&gt; 'LocationsController@find']);
  </code></pre>
  
  <p>and This takes me to the controller </p>
  
  <pre><code>public function Find($lat,$lng)
  {
  
  
      $URLToCall = "https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=".$lat.",".$lng."&amp;key=".self::$apiKey;
      // $URLToCall = "https://maps.googleapis.com/maps/api/geocode/json?address=".urlencode($placeName)."&amp;key=".self::$apiKey;
      $result = json_decode(file_get_contents($URLToCall),true);
      if($result['status'] == "OK") {
          $URLToCall = "https://maps.googleapis.com/maps/api/place/details/json?placeid=".$result['results'][0]['place_id']."&amp;key=".self::$apiKey;
          $result = json_decode(file_get_contents($URLToCall),true);
          // echo $URLToCall;
          // print_r($result);
          $googlePlaceData =  $result['result'];
          $place_id = $googlePlaceData['place_id'];
          $address = $googlePlaceData['name'];
  
          $name = $googlePlaceData['name'];
          $lat = $googlePlaceData['geometry']['location']['lat'];
          $lng = $googlePlaceData['geometry']['location']['lng'];
          $formatted_address = $googlePlaceData['formatted_address'];
          // echo $formatted_address;
          // dd($result['result']);
          $location = LocationRepository::get($place_id, $address);
  
          echo $location;
          // return response()-&gt;json(json_decode($location));
      } else {
          echo "Could not Find Data";
      }
  }
  }
  </code></pre>
  
  <p>Now when I add a new Location I get 
      Request Method:GET
      Status Code:500 Internal Server Error</p>
  
  <p>But when I refresh the same Url I get the data the way I want it. 
  the problem should be with the way I return data. But I cant figure out how am I supposed to get it down. The minute I add a new lat, lng which I don't have saved in my location database. I get this error.
  Any help here will be appreciated. Thanks</p>