$httpClient = new Client();
$response = $httpClient->get(
$url,
[
RequestOptions::SINK => $pathFile,
]
);
if ($response->getStatusCode() === 200) {
$record = UploadImage::create([
'path' => $relativePath,
]);
$httpPath = config('app.url') . $record->path;
return response([
'success' => true,
'file' => [
'url' => $httpPath
]
]);
}