Hi guys,
I’m trying to pass the current post category from the Controller to my Blade template. But when I call the controller function it’s running for each post and not just my current post in the post loop.
What am I doing wrong?
<div class="postitem__image">
<span class="postitem__label"> {{get_category()}} </span>
</div>
public function getCategory()
{
$categories = get_the_category(get_the_ID());
echo"<pre>";
print_r($categories);
echo"</pre>";
return"test";
return $categories;
}