public static function bindFromResponse(\App\Place &$place, &$stdPlace) { $timestamp = \Carbon\Carbon::now()->toDateTimeString(); $place->lat = $stdPlace->geometry->location->lat; $place->lng = $stdPlace->geometry->location->lng; $place->ext_id = $stdPlace->id; $place->icon = $stdPlace->icon; $place->name = $stdPlace->name; $place->place_id = $stdPlace->place_id; $place->reference = $stdPlace->reference; $place->scope = $stdPlace->scope; $place->vicinity = $stdPlace->vicinity; $place->created_at = $timestamp; $place->updated_at = $timestamp; $place->rating = null; if (property_exists($stdPlace, 'rating')) { $place->rating = $stdPlace->rating; } if (property_exists($stdPlace, 'photos')) { foreach ($stdPlace->photos as $photo) { \App\Photo::createFromApi($place->id, $photo); } } }