public static function createFromApi($placeId, $apiData) { $photo = self::create(['place_id' => $placeId, 'photo_reference' => $apiData->photo_reference, 'width' => $apiData->width, 'height' => $apiData->height]); $response = \App\Api\Place::getPhoto($apiData->photo_reference); file_put_contents(\Config::get('place.photo_path') . $photo->id . '.jpg', $response->getResultPhoto()); unset($response); }