Skip to content
Discussion options

You must be logged in to vote

@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!

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@flowbru
Comment options

@erikn69
Comment options

Answer selected by freekmurze
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants