Update
parent
a037f82a5f
commit
01a057bfc8
|
|
@ -148,8 +148,13 @@ class DeviceLogSyncCommand extends Command
|
||||||
if ($ext = pathinfo($item['url'], PATHINFO_EXTENSION)) {
|
if ($ext = pathinfo($item['url'], PATHINFO_EXTENSION)) {
|
||||||
$name .= ".{$ext}";
|
$name .= ".{$ext}";
|
||||||
}
|
}
|
||||||
|
|
||||||
$path = "{$dir}/{$name}";
|
$path = "{$dir}/{$name}";
|
||||||
|
|
||||||
|
$disk = Storage::disk('public');
|
||||||
|
if (! $disk->exists($path)) {
|
||||||
$disk->put($path, file_get_contents($item['url']));
|
$disk->put($path, file_get_contents($item['url']));
|
||||||
|
}
|
||||||
|
|
||||||
WormPhoto::firstOrCreate([
|
WormPhoto::firstOrCreate([
|
||||||
'device_id' => $device->id,
|
'device_id' => $device->id,
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ class WormPhotoResource extends JsonResource
|
||||||
return [
|
return [
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'url' => $this->image_url,
|
'url' => $this->image_url,
|
||||||
'time' => $this->created_at->toDateTimeString(),
|
'time' => $this->uploaded_at->toDateTimeString(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue