binshops / laravel-blog

Laravel Blog Package/ Laravel CMS. Easiest way to add a blogging system to your Laravel website. Laravel Blog.

Home Page:https://www.binshops.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Category Not Displayed Properly

scs-ben opened this issue · comments

commented

Trying to get the categories for a post to display is not currently possible.

If I dump out the categories I get this data blob:
[{"id":2,"created_by":null,"parent_id":null,"lft":1,"rgt":2,"depth":0,"created_at":"2021-12-23T17:32:11.000000Z","updated_at":"2021-12-23T17:32:11.000000Z","pivot":{"post_id":1,"category_id":2}}]

but if I try to iterate over, there is no relationship available to get the category name.

The provided code in categories.blade.php also does not work:

    @foreach($post->categories as $category)
        <a class='btn btn-outline-secondary btn-sm m-1' href='{{$category->url()}}'>
            {{$category->category_name}}
        </a>
    @endforeach```
commented

I dug into this and realized that the issue is I need to pull the category name out of the category translations. I'm not sure that the categories.blade.php actually works though.

Issue fixed with this new update: v9.2.6
Also, you need to change your view files.

commented

Thanks!