untymage
1 week ago

How can i load a relationship on Illuminate\Support\Collection

Posted 1 week ago by untymage

i want to load tags relation on the chain for threadmodel :

$this->groups->pluck('thread')->load('tags')->pluck('tags.*.name')->collapse()->toArray();

after first pluck :

img

But it says:

Method Illuminate\Support\Collection::load does not exist.

I know i can add $with propety to my model but i would like to have that on the chain.

How can i have a Illuminate\Database\Eloquent\Collection instead of Illuminate\Support\Collection ?

Please sign in or create an account to participate in this conversation.