芝麻web文件管理V1.00
编辑当前文件:/home/digitalh/digitalbdit.com/core/app/Models/Item.php
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; } } } }