⚝
One Hat Cyber Team
⚝
Your IP:
3.147.72.3
Server IP:
162.254.39.145
Server:
Linux premium289.web-hosting.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
Server Software:
LiteSpeed
PHP Version:
8.2.28
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
proc
/
self
/
root
/
home
/
favoaysf
/
www
/
app
/
Models
/
View File Name :
Item.php
<?php namespace App\Models; use App\Models\Wishlist; use Illuminate\Database\Eloquent\Model; class Item extends Model { protected $fillable = ['category_id','subcategory_id','childcategory_id','brand_id','name','slug','sku','tags','video','sort_details','specification_name','specification_description','is_specification','details','photo','thumbnail','discount_price','previous_price','stock','meta_keywords','meta_description','status','is_type','tax_id','date','item_type','file','link','file_type','license_name','license_key','affiliate_link']; public function category() { return $this->belongsTo('App\Models\Category')->withDefault(); } public function subcategory() { return $this->belongsTo('App\Models\Subcategory')->withDefault(); } public function childcategory() { return $this->belongsTo('App\Models\ChieldCategory')->withDefault(); } public function brand() { return $this->belongsTo('App\Models\Brand')->withDefault(); } public function campaigns() { return $this->hasMany('App\Models\CampaignItem'); } public function tax() { return $this->belongsTo('App\Models\Tax')->withDefault(); } public function attributes() { return $this->hasMany('App\Models\Attribute'); } public function galleries() { return $this->hasMany('App\Models\Gallery'); } public function reviews() { return $this->hasMany('App\Models\Review'); } public static function taxCalculate($item) { if($item->tax){ $price = $item->discount_price; $percentage = $item->tax->value; $tax = ($price * $percentage) / 100; return $tax; }else{ return 0; } } public function getWishlistItemId() { return Wishlist::whereItemId($this->id)->first()->id; } public function user() { return $this->belongsTo('App\Models\User','vendor_id')->withDefault(); } public function is_stock() { $item = $this; // license product stock check------------ if($item->item_type == 'license'){ if($item->license_key){ $lisense_key = json_decode($item->license_key,true); if(count($lisense_key) > 0){ return true; }else{ return false; } }else{ return false; } } // digital product stock check------------- if($item->item_type == 'digital'){ return true; } if($item->item_type == 'affiliate'){ return true; } // physical product stock check if($item->item_type == 'normal'){ if($item->stock){ if($item->stock != 0){ return true; }else{ return false; } }else{ return false; } } } }