Advertisement
majweb

Untitled

Aug 9th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.29 KB | None | 0 0
  1. if ((isset($resultObject->status) && $resultObject->status == self::GOOGLE_RESPONSE_ZERO_RESULTS) ||
  2.             !isset($resultObject->results) ||
  3.             (isset($resultObject->results) && count($resultObject->results) == 0)
  4.         ) {
  5.             throw new MapperSearchResultException('No results found for the location search.');
  6.         }
  7.  
  8.         if (!isset($resultObject->results[0]->formatted_address) ||
  9.             !isset($resultObject->results[0]->address_components[0]->types[0]) ||
  10.             !isset($resultObject->results[0]->geometry->location->lat) ||
  11.             !isset($resultObject->results[0]->geometry->location->lng) ||
  12.             !isset($resultObject->results[0]->place_id) ||
  13.             isset($resultObject->status) && $resultObject->status != self::GOOGLE_RESPONSE_OK
  14.         ) {
  15.             throw new MapperException('The location search return invalid result data.');
  16.         }
  17.  
  18. mam kontroler i metodę gdzie iteruje po elementach:
  19. if($user->connected_to_gyms){
  20.    foreach($user->connected_to_gyms as $key =>$man){
  21.           Mapper::location("$man->city $man->street $man->local")->map(['zoom' => 15, 'center' => true, 'marker' => true, 'type' => 'roadmap']);
  22.          }
  23. }
  24. i widok:
  25. @foreach($user->connected_to_gyms as $key =>$man)
  26.     <div class="col-xs-12 col-md-3 text-center" style="height: 200px;">
  27.          {!! Mapper::render ($key) !!}
  28.     </div>
  29. @endforeach
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement