-
I'm trying to download all the documents together that belong to one user. If one user has uploaded documents under multiple collections, I want to download all uploads under all collections in one click as a zip file. I tried without the collection name in getMedia function. But it's not getting my result. $user = User::where('id',auth()->user()->id)->first(); |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Use the Media model and filter the user on the relation, for example using |
Beta Was this translation helpful? Give feedback.
-
I got it. thank you @erikn69 $user = User::where('id',auth()->user()->id)->first(); |
Beta Was this translation helpful? Give feedback.
I got it. thank you @erikn69
$user = User::where('id',auth()->user()->id)->first();
$downloads = ModelsMedia::where('model_id',$user->id)->get();
return MediaStream::create('myfiles.zip')->addMedia($downloads);