!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-163-generic #173-Ubuntu SMP Tue Oct 14 17:51:00 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/home/picotech/domains/adflow-backend.picotech.app/public_html/app/Http/Controllers/   drwxr-xr-x
Free 25.13 GB of 117.98 GB (21.3%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     DashboardController.php (5.11 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

namespace App\Http\Controllers;

use 
Illuminate\Http\Request;
use 
Illuminate\Support\Facades\Auth;
use 
App\Models\Campaign;
use 
App\Models\CampaignPerformance;
use 
App\Models\Wallet;
use 
App\Models\HilltopAccount;
use 
Carbon\Carbon;

class 
DashboardController extends Controller
{
    public function 
getKpis()
    {
        
$user Auth::user();
        
$userId $user->id;

        
// Available Balance
        
$wallet $user->wallet;
        
$balance $wallet $wallet->balance 0;
        
        
// Calculate balance change (mock logic for now as we don't have historical balance snapshots easily accessible without complex queries)
        // Or we could check recent transactions. Let's keep it simple for now.
        
$balanceChange '+$0.00 this week'
        
$balanceChangeType 'neutral';

        
// Active Campaigns
        
$activeCampaignsCount Campaign::where('user_id'$userId)
            ->
where('status''active')
            ->
count();
        
        
// Today's Spend
        
$today Carbon::today();
        
$todaysSpend CampaignPerformance::whereHas('campaign', function ($query) use ($userId) {
                
$query->where('user_id'$userId);
            })
            ->
where('date'$today)
            ->
sum('spend');
        
        
// Yesterday's Spend for comparison
        
$yesterday Carbon::yesterday();
        
$yesterdaysSpend CampaignPerformance::whereHas('campaign', function ($query) use ($userId) {
                
$query->where('user_id'$userId);
            })
            ->
where('date'$yesterday)
            ->
sum('spend');

        
$spendChange 0;
        
$spendChangeType 'neutral';
        if (
$yesterdaysSpend 0) {
            
$spendChange = (($todaysSpend $yesterdaysSpend) / $yesterdaysSpend) * 100;
            
$spendChangeType $spendChange 'negative' 'positive'// Higher spend is usually "negative" for wallet, but "positive" for scale. Let's stick to "spend increase" = neutral/info. 
            // Actually, usually higher spend is "neutral" or "negative" if ROI isn't higher. Let's use neutral.
            // But the UI uses green for positive. Let's assume higher spend is good (scaling).
            
$spendChangeType $spendChange >= 'positive' 'neutral';
        }

        
// Estimated Profit (Placeholder as we don't have revenue tracking yet)
        
$estimatedProfit 0;
        
$profitChange '0% this month';
        
$profitChangeType 'neutral';

        
// Account Status
        
$account HilltopAccount::where('assigned_user_id'$userId)->first();
        
$accountData null;
        if (
$account) {
            
$accountData = [
                
'alias' => $account->alias,
                
'status' => 'Active' // Assuming if assigned it's active
            
];
        }

        return 
response()->json([
            
'available_balance' => [
                
'value' => '$' number_format($balance2),
                
'change' => $balanceChange,
                
'change_type' => $balanceChangeType
            
],
            
'active_campaigns' => [
                
'value' => (string)$activeCampaignsCount,
                
'change' => ''// Could calculate change if we tracked history
                
'change_type' => 'neutral'
            
],
            
'todays_spend' => [
                
'value' => '$' number_format($todaysSpend2),
                
'change' => ($spendChange >= '+' '') . number_format($spendChange1) . '% vs yesterday',
                
'change_type' => $spendChangeType
            
],
            
'estimated_profit' => [
                
'value' => '$' number_format($estimatedProfit2),
                
'change' => $profitChange,
                
'change_type' => $profitChangeType
            
],
            
'account_status' => $accountData
        
]);
    }

    public function 
getCampaigns()
    {
        
$userId Auth::id();

        
$campaigns Campaign::where('user_id'$userId)
            ->
with(['performances' => function($query) {
                
// We might want to limit performances or aggregate them
            
}])
            ->
orderBy('created_at''desc')
            ->
take(10// Limit to recent 10
            
->get();

        
$formattedCampaigns $campaigns->map(function ($campaign) {
            
// Aggregate stats
            
$spend $campaign->performances->sum('spend');
            
$impressions $campaign->performances->sum('impressions');
            
$clicks $campaign->performances->sum('clicks');
            
            
$ctr $impressions ? ($clicks $impressions) * 100 0;

            return [
                
'id' => $campaign->id,
                
'name' => $campaign->name,
                
'status' => $campaign->status,
                
'daily_cap' => '$' number_format($campaign->daily_budget2),
                
'spend' => '$' number_format($spend2),
                
'impressions' => number_format($impressions),
                
'clicks' => number_format($clicks),
                
'ctr' => number_format($ctr2) . '%',
                
'cost' => '$' number_format($spend2// Same as spend
            
];
        });

        return 
response()->json($formattedCampaigns);
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0043 ]--