Skip to content

List collections of a model #3418

Answered by tobiasla78
monzer15 asked this question in Q&A
Discussion options

You must be logged in to vote

I would do it with a query like this

use Spatie\MediaLibrary\MediaCollections\Models\Media;

$media = Media::where('model_type', 'App\Models\User')->get()->pluck('collection_name')->unique();

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@monzer15
Comment options

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