display more than one tag on views

Posted 1 year ago by helpmyworld

Good day, how do I display all selected tags to show in my posts views. When I dd, I see that I have more than one tag but on the view, it shows only one, the first tag.

my view

 <dl class="dl-horizontal">
                            <dt>Tags:</dt>
                            <dd>
                                @foreach($post->tags as $tag)
                                    <span class="label label-default"><a href="{{route('tags.show',
                                  $tag->id)}}" style="color:white;">{{$tag->name}}</a></span>
                                @endforeach
                            </dd>
                        </dl>

My post and tag models are ok.

What else should I show you to help?

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

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.