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) {
|
||||
$imageData = json_decode($imageUri, true);
|
||||
|
||||
if ($file = page('materials')->file($imageData['uuid'])) {
|
||||
|
||||
try {
|
||||
$copiedFile = $file->copy($page);
|
||||
$updatedFile = $file->update([
|
||||
'description' => $imageData['description'],
|
||||
'tags' => $imageData['tags'],
|
||||
]);
|
||||
$source = page('materials')->file($imageData['uuid']);
|
||||
try {
|
||||
$copiedFile = $source->copy($page);
|
||||
$updatedFile = $source->update([
|
||||
'description' => $imageData['description'],
|
||||
'tags' => $imageData['tags'],
|
||||
]);
|
||||
|
||||
$allFiles[] = (string) $updatedFile->uuid();
|
||||
} catch (Exception $e) {
|
||||
$alerts[$file->name()] = $e->getMessage();
|
||||
}
|
||||
$allFiles[] = (string) $updatedFile->uuid();
|
||||
} catch (Exception $e) {
|
||||
$alerts[$source->name()] = $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue