Support the ongoing development of Laravel.io →
posted 7 years ago
Eloquent
Last updated 2 years ago.
0

Code please

0

Code please

Last updated 7 years ago.
0

the end goal is to concatate tag_names into a comma separated list

this returns an error of implode(): Invalid arguments passed:

$tags = ResourceTag::where('resource_id', $resource->id)->pluck('tag_name');

$tags = implode(", ", $tags);

but this works ok (going thru each result and adding it to an array manually):

$tags = ResourceTag::where('resource_id', $resource->id)->pluck('tag_name');
foreach($tags as $t) {
    $tagString[] = $t ; 
}
$tags = implode(", ", $tagString); // turn array into string
0

Sign in to participate in this thread!

Eventy

Your banner here too?

RexT4 rext4 Joined 2 Apr 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.