-
I have a vue component (using pro), and am trying to upload multiple images at once using addFromMediaLibraryRequest: $project
->addFromMediaLibraryRequest($request->attachments)
->withCustomProperties([
'author_id' => auth()->id(),
'author_name' => auth()->user()->name,
])
->toMediaCollection('attachments'); But I keep getting the error: Many thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Did you find a solution to this? I need the exact same thing... |
Beta Was this translation helpful? Give feedback.
-
@flowbru just had a look back at the project I had the issues with and looks like I didn't find a direct fix. I landed with this approach though: if (auth()->user()->isInTeam($client->id) || auth()->user()->isAdmin) {
$project
->addFromMediaLibraryRequest($request->attachments)
->toMediaCollection('attachments');
foreach ($request->attachments as $image) {
$mediaItem = Media::where('uuid', $image['uuid'])->first();
$mediaItem->setCustomProperty('author', [
'id' => auth()->id(),
'name' => auth()->user()->name
]);
$mediaItem->save();
}
} Not particularly efficient, but does the job! Hope this helps! |
Beta Was this translation helpful? Give feedback.
@flowbru just had a look back at the project I had the issues with and looks like I didn't find a direct fix. I landed with this approach though:
Not particularly efficient, but does the job!
Hope this helps!