@if ($category->subcategories->isNotEmpty())
@php
// Get current language from Session
$currentLang = Session::get('language');
// Check RTL: use accessor which returns boolean (rtl != 0)
$isRtl = false;
if (!empty($currentLang)) {
try {
// Try to get raw attribute first, fallback to accessor
$rtlRaw = method_exists($currentLang, 'getRawOriginal') ? $currentLang->getRawOriginal('rtl') : null;
if ($rtlRaw !== null) {
$isRtl = ($rtlRaw == 1 || $rtlRaw === true);
} else {
$isRtl = ($currentLang->rtl == true || $currentLang->rtl === 1);
}
} catch (\Exception $e) {
$isRtl = ($currentLang->rtl == true || $currentLang->rtl === 1);
}
}
$arrowIcon = $isRtl ? '' : ''; // fa-caret-left for RTL, fa-caret-right for LTR
@endphp
{!! $arrowIcon !!}
@include('items.treeview', ['categories' => $category->subcategories, 'selected_category' => $selected_category])
@endif
@endforeach