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


Viewing file:     OrderDetail.php (7.44 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
/**
 * @package OrderDetail
 * @author TechVillage <support@techvill.org>
 * @contributor Sakawat Hossain Rony <[sakawat.techvill@gmail.com]>
 * @created 14-12-2021
 */
namespace App\Models;

use 
App\Models\Model;
use 
Auth;
use 
Carbon\Carbon;
use 
Modules\Commission\Http\Models\OrderCommission;
use 
Modules\Refund\Entities\Refund;

class 
OrderDetail extends Model
{
    
/**
     * Foreign key with Shop model
     *
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    
public function shop()
    {
        return 
$this->belongsTo('\Modules\Shop\Http\Models\Shop''shop_id');
    }

    
/**
     * Foreign key with Product model
     *
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    
public function product()
    {
        return 
$this->belongsTo('App\Models\Product''product_id');
    }

    
/**
     * Foreign key with ProductMeta model
     *
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    
public function productMeta()
    {
        return 
$this->hasMany(ProductMeta::class, 'product_id''product_id');
    }

    
/**
     * Foreign key with productCategory model
     *
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    
public function productCategory()
    {
        return 
$this->belongsTo('App\Models\ProductCategory''product_id''product_id');
    }

    
/**
     * Foreign key with Order model
     *
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    
public function order()
    {
        return 
$this->belongsTo('App\Models\Order''order_id');
    }

    
/**
     * Foreign key with Vendor model
     *
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    
public function vendor()
    {
        return 
$this->belongsTo('App\Models\Vendor''vendor_id');
    }

    
/**
     * Foreign key with OrderStatus model
     *
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    
public function orderStatus()
    {
        return 
$this->belongsTo('App\Models\OrderStatus''order_status_id');
    }

    
/**
     * Relation with Refund model
     *
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     */
    
public function refund()
    {
        return 
$this->hasOne(\Modules\Refund\Entities\Refund::class);
    }

    
/**
     * Relation with Refund model
     *
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    
public function refunds()
    {
        return 
$this->hasMany(\Modules\Refund\Entities\Refund::class);
    }

    
/**
     * product details
     *
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    
public function productDetails()
    {
        return 
$this->belongsTo('App\Models\ProductDetail''product_id''product_id');
    }

    
/**
     * Relation with Shipping model
     *
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    
public function shipping()
    {
        return 
$this->belongsTo(\Modules\Shipping\Entities\Shipping::class);
    }

    
/**
     * Relation with Product model
     *
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    
public function parentProduct()
    {
        return 
$this->belongsTo(Product::class, 'parent_id''id');
    }

    
/**
     * Store
     *
     * @param array $data
     * @return int|null
     */
    
public function store($data = [])
    {
        if (
parent::insert($data)) {
            return 
true;
        }
        return 
false;
    }

    
/**
     * Update OrderDetail
     *
     * @param array $data
     * @param null $id
     * @return bool
     */
    
public function updateOrder($data = [], $id null)
    {
        
$result parent::where('id'$id)->first();

        if (!empty(
$result)) {

            if (isset(
$data['order_status_id'])) {
                
$res $result->checkStatus($data['order_status_id']);
                if (
$res['status'] == true) {
                    
$data['is_stock_reduce'] = $res['is_stock_reduce'];
                }
            }

            
parent::where('id'$id)->update($data);

            return 
true;
        }

        return 
false;
    }

    
/**
     * check order status
     *
     * @param $statusId
     * @return array
     */
    
public function checkStatus($statusId)
    {
        
$orderStatusInfo OrderStatus::getAll()->where('id'$statusId)->first();
        
$data = ['status' => false'is_stock_reduce' => 0];
        
$type 'self';

        if (
$this->product->type == 'Variation' && $this->product->isStockManageable() != && isset($this->product->parentDetail) && $this->product->parentDetail->isStockManageable() == 1) {
            
$type 'parent';
        }

        if (
$orderStatusInfo->slug == 'cancelled' && $this->is_stock_reduce == 1) {

            if (
$type == 'parent') {
                
$this->product->parentDetail->incrementTotalStocks($this->quantity);
            } else {
                
$this->product->incrementTotalStocks($this->quantity);
            }

            
$data = ['status' => true'is_stock_reduce' => 0];
        } elseif (
in_array($orderStatusInfo->slug, ["processing""completed""on-hold"]) && $this->is_stock_reduce != && optional($this->product)->isStockReduce($orderStatusInfo->slug)) {

            if (
$type == 'parent') {
                
$this->product->parentDetail->decrementTotalStocks($this->quantity);
            } else {
                
$this->product->decrementTotalStocks($this->quantity);
            }

            
$data = ['status' => true'is_stock_reduce' => 1];
        } elseif (
$orderStatusInfo->payment_scenario != 'paid' && $this->is_stock_reduce == 1) {

            if (
$type == 'parent') {
                
$this->product->parentDetail->incrementTotalStocks($this->quantity);
            } else {
                
$this->product->incrementTotalStocks($this->quantity);
            }
            
$data = ['status' => true'is_stock_reduce' => 0];
        }

        return 
$data;
    }

    
/**
     * Check order product refundable status
     * @return bool
     */
    
public function isRefundable() {

        if (
$this->is_delivery == 0) {
            return 
false;
        }

        if (
$this->quantity > (isset($this->refund) ? $this->refunds()->sum('quantity_sent') : 0)) {
            return 
true;
        }

        return 
false;
    }

    
/**
     * Check order product refunded status
     * @return bool
     */
    
public function isRefunded() {

        if (
$this->is_delivery == 0) {
            return 
false;
        }

        if (
$this->quantity == (isset($this->refund) ? $this->refunds()->sum('quantity_sent') : 0)) {
            return 
true;
        }

        return 
false;
    }

    
/**
     * get product ship on time or not
     *
     * @return int
     */
    
public function isInTime()
    {
        
$deliveryDays $this->created_at->diffInDays(Carbon::now());
        
$estimateDeliveryDays $this->productMeta->where('key''meta_estimated_delivery')->first();
        
$inTimeDelivery = !empty($estimateDeliveryDays) && $estimateDeliveryDays->value != '' && $deliveryDays <= (int)$estimateDeliveryDays->value ||
        !empty(
$estimateDeliveryDays) && $estimateDeliveryDays->value == '' || empty($estimateDeliveryDays) ? 0;

        return 
$inTimeDelivery;
    }

}

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