Updated dashboard
This commit is contained in:
@@ -35,18 +35,10 @@ class DashboardController extends Controller
|
|||||||
->groupBy('subscribe_plans.name', 'user_subscribers.market_provider')
|
->groupBy('subscribe_plans.name', 'user_subscribers.market_provider')
|
||||||
->get();
|
->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) {
|
$paidBreakdown->each(function ($item) {
|
||||||
$provider = strtolower($item->market_provider ?? '');
|
$provider = !empty($item->market_provider) ? $item->market_provider : 'سایت / مستقیم';
|
||||||
|
$item->display_name = $item->plan_name . ' (' . $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 . ' (سایت / مستقیم)';
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Total paid is the sum of the breakdown
|
// Total paid is the sum of the breakdown
|
||||||
|
|||||||
Reference in New Issue
Block a user