PATH:
home
/
lab2454c
/
vaultchip.com
/
platform
/
plugins
/
ecommerce
/
src
/
Models
<?php namespace Botble\Ecommerce\Models; use Botble\Base\Enums\BaseStatusEnum; use Botble\Base\Models\BaseModel; use Botble\Base\Traits\EnumCastable; use Illuminate\Database\Eloquent\Relations\BelongsToMany; class ProductCollection extends BaseModel { use EnumCastable; /** * The database table used by the model. * * @var string */ protected $table = 'ec_product_collections'; /** * @var array */ protected $fillable = [ 'name', 'slug', 'description', 'image', 'status', 'is_featured', ]; /** * @var array */ protected $casts = [ 'status' => BaseStatusEnum::class, ]; protected static function boot() { parent::boot(); self::deleting(function (ProductCollection $collection) { $collection->discounts()->detach(); }); } /** * @return BelongsToMany */ public function discounts() { return $this->belongsToMany(Discount::class, 'ec_discount_customers', 'customer_id', 'id'); } /** * @return BelongsToMany */ public function products() { return $this ->belongsToMany( Product::class, 'ec_product_collection_products', 'product_collection_id', 'product_id' ) ->where('is_variation', 0); } /** * @return BelongsToMany */ public function promotions() { return $this ->belongsToMany(Discount::class, 'ec_discount_product_collections', 'product_collection_id') ->where('type', 'promotion') ->where('start_date', '<=', now()) ->where('target', 'group-products') ->where(function ($query) { return $query ->whereNull('end_date') ->orWhere('end_date', '>=', now()); }) ->where('product_quantity', 1); } }
[-] ProductLabelTranslation.php
[edit]
[-] Review.php
[edit]
[-] ShippingRule.php
[edit]
[+]
..
[-] Discount.php
[edit]
[-] Address.php
[edit]
[-] GroupedProduct.php
[edit]
[-] StoreLocator.php
[edit]
[-] ProductAttribute.php
[edit]
[-] OrderHistory.php
[edit]
[-] ShipmentHistory.php
[edit]
[-] ProductVariation.php
[edit]
[-] DiscountProductCollection.php
[edit]
[-] ProductAttributeTranslation.php
[edit]
[-] ProductCollection.php
[edit]
[-] Order.php
[edit]
[-] Wishlist.php
[edit]
[-] ProductTag.php
[edit]
[-] Customer.php
[edit]
[-] BrandTranslation.php
[edit]
[-] Tax.php
[edit]
[-] FlashSale.php
[edit]
[-] ProductAttributeSetTranslation.php
[edit]
[-] ProductCollectionTranslation.php
[edit]
[-] OrderAddress.php
[edit]
[-] DiscountProduct.php
[edit]
[-] DiscountCustomer.php
[edit]
[-] Shipping.php
[edit]
[-] Brand.php
[edit]
[-] ProductTranslation.php
[edit]
[-] ProductVariationItem.php
[edit]
[-] Product.php
[edit]
[-] ProductLabel.php
[edit]
[-] OrderProduct.php
[edit]
[-] Currency.php
[edit]
[-] ShippingRuleItem.php
[edit]
[-] ProductAttributeSet.php
[edit]
[-] FlashSaleTranslation.php
[edit]
[-] ProductCategory.php
[edit]
[-] Shipment.php
[edit]
[-] ProductCategoryTranslation.php
[edit]