Updated dashboard

This commit is contained in:
m.razaghi
2026-08-09 17:02:19 +03:30
parent 6c157e79e4
commit 1be9ed98b8

View File

@@ -35,18 +35,10 @@ class DashboardController extends Controller
->groupBy('subscribe_plans.name', 'user_subscribers.market_provider')
->get();
// Format the display name to show the source clearly
// Dynamically format the display name using the provider directly from the DB
$paidBreakdown->each(function ($item) {
$provider = strtolower($item->market_provider ?? '');
if ($provider === 'bazar') {
$item->display_name = $item->plan_name . ' (کافه بازار)';
} elseif ($provider === 'myket') {
$item->display_name = $item->plan_name . ' (مایکت)';
} else {
// If market_provider is null or empty, it was purchased directly from the site
$item->display_name = $item->plan_name . ' (سایت / مستقیم)';
}
$provider = !empty($item->market_provider) ? $item->market_provider : 'سایت / مستقیم';
$item->display_name = $item->plan_name . ' (' . $provider . ')';
});
// Total paid is the sum of the breakdown