From what I can understand you have a One-to-Many relationship in your logic. So, One writer can have many posts. My question to you: why would you loop your variable writer if you only have one?
@foreach($blog->writer as $writer)
<span>{{$writer->name}}</span>
@endforeach
The code above makes no sence. IF you want a Many-To-Many relationship then you have to change your logic... In that case you will have that Many Writers have written in a Post.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community