Level 51
@untymage If you only want an array of tag names:
$this->groups->tags->pluck('name')->toArray();
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 :

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 ?
Load the relationships before the pluck. All of the collection methods return the Illuminate\Support\Collection class because they are defined on that class.
This should work:
$this->groups->load('thread.tags')->pluck('thread.*.tags.*.name');
Please or to participate in this conversation.