@php use App\Constants\Constant; use App\Models\Package; use App\Http\Helpers\Uploader; use App\Http\Helpers\LimitCheckerHelper; // Initialize variables $infoIcon = false; $username = ''; $userId = Auth::guard('web')->user()->admin_id ?? Auth::guard('web')->user()->id; // Fetch the user's username if (Auth::guard('web')->user()->admin_id != null) { $user = App\Models\User::where('id', Auth::guard('web')->user()->admin_id)->first(); $username = $user->username; } else { $username = Auth::guard('web')->user()->username; } // Fetch the current package $packageId = LimitCheckerHelper::getMembershipId($userId); $currentPackage = Package::find($packageId); // Check if the current package exists if ($currentPackage) { $feature = json_decode($currentPackage->features, true); // Fetch usage counts $staffCount = LimitCheckerHelper::staffCount($userId); $storageCount = LimitCheckerHelper::storageCount($userId, 'storage_usage'); $orderCount = LimitCheckerHelper::orderCount($userId); $categoryCount = LimitCheckerHelper::categoryCount($userId); $subcategoryCount = LimitCheckerHelper::subcategoryCount($userId); $itemCount = LimitCheckerHelper::itemCount($userId); $languageCount = LimitCheckerHelper::languageCount($userId); $reservationCount = LimitCheckerHelper::getTableReservationCount($userId); // Check if any limit is exceeded if ( $reservationCount >= ($currentPackage->table_reservation_limit ?? PHP_INT_MAX) || $orderCount >= ($currentPackage->order_limit ?? PHP_INT_MAX) || $staffCount > ($currentPackage->staff_limit ?? PHP_INT_MAX) || $storageCount > ($currentPackage->storage_limit ?? PHP_INT_MAX) || $categoryCount > ($currentPackage->categories_limit ?? PHP_INT_MAX) || $subcategoryCount > ($currentPackage->subcategories_limit ?? PHP_INT_MAX) || $itemCount > ($currentPackage->items_limit ?? PHP_INT_MAX) || $languageCount > ($currentPackage->language_limit ?? PHP_INT_MAX) ) { $infoIcon = true; } } else { // Handle case where the user has no active package $infoIcon = true; } @endphp
cookie('user-theme') == 'dark') data-background-color="dark2" @endif> @if ($userBs->logo) @else @endif