simplify
This commit is contained in:
parent
97262303fc
commit
53ca51c154
1 changed files with 10 additions and 12 deletions
|
|
@ -29,19 +29,17 @@ return [
|
||||||
foreach ($data['imageUris'] as $imageUri) {
|
foreach ($data['imageUris'] as $imageUri) {
|
||||||
$imageData = json_decode($imageUri, true);
|
$imageData = json_decode($imageUri, true);
|
||||||
|
|
||||||
if ($file = page('materials')->file($imageData['uuid'])) {
|
$source = page('materials')->file($imageData['uuid']);
|
||||||
|
try {
|
||||||
try {
|
$copiedFile = $source->copy($page);
|
||||||
$copiedFile = $file->copy($page);
|
$updatedFile = $source->update([
|
||||||
$updatedFile = $file->update([
|
'description' => $imageData['description'],
|
||||||
'description' => $imageData['description'],
|
'tags' => $imageData['tags'],
|
||||||
'tags' => $imageData['tags'],
|
]);
|
||||||
]);
|
|
||||||
|
|
||||||
$allFiles[] = (string) $updatedFile->uuid();
|
$allFiles[] = (string) $updatedFile->uuid();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$alerts[$file->name()] = $e->getMessage();
|
$alerts[$source->name()] = $e->getMessage();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue