@php
    if (!empty($args['show_hierarchy'])) {
        $categoryObj = new \app\models\BlogCategory();
        $categories = $categoryObj->generateCategoryTreeList();
    }else{
        $blogObj = new \app\models\Blog();
        $categories = $blogObj->categoryWidget()->pluck('title','id')->toArray();
    }
@endphp


<div class="p-30 bg-white dark:bg-card sm:mb-30 mb-20 widget widget_categories style-1">
    <div class="mb-20 widget-title">
        <h4 class="text-[26px] font-semibold text-secondary dark:text-white title">{{ $args['title'] ?? __('Categories') }}</h4>
    </div>
    <ul class="">
        @forelse($categories as $id => $title)
            <li class="text-xl/42 text-lightgreen dark:text-white/70 font-normal relative flex justify-between">
                <a href="{{DzHelper::laraBlogCategoryLink($id)}}">{{ $title }}</a>
                @if (!empty($args['show_post_counts']))
                    ({{DzHelper::getCategoryBlogCount($id)}})
                @endif
            </li>
        @empty
        @endforelse
    </ul>
</div>