I have a collection of objects. Let\'s say the objects are tags:
$tags = Tag::all();
I want to retrieve a certain attribute for each tag, say i
You could use array_column for this (it's a PHP 5.5 function but Laravel has a helper function that replicates the behavior, for the most part).
array_column
Something like this should suffice.
$tag_names = array_column($tags->toArray(), 'name');