/
home
/
techb158
/
immovalet.com
/
platform
/
plugins
/
ecommerce
/
src
/
Models
/
/home/techb158/immovalet.com/platform/plugins/ecommerce/src/Models
mkdir
upload
Name
Size
Mode
Actions
Address.php
756
0644
edit
dl
rm
Brand.php
976
0644
edit
dl
rm
BrandTranslation.php
479
0644
edit
dl
rm
Currency.php
459
0644
edit
dl
rm
Customer.php
3169
0644
edit
dl
rm
Discount.php
1992
0644
edit
dl
rm
DiscountCustomer.php
543
0644
edit
dl
rm
DiscountProduct.php
537
0644
edit
dl
rm
DiscountProductCollection.php
600
0644
edit
dl
rm
FlashSale.php
1734
0644
edit
dl
rm
FlashSaleTranslation.php
471
0644
edit
dl
rm
GroupedProduct.php
462
0644
edit
dl
rm
Order.php
4503
0644
edit
dl
rm
OrderAddress.php
1022
0644
edit
dl
rm
OrderHistory.php
1162
0644
edit
dl
rm
OrderProduct.php
1300
0644
edit
dl
rm
Product.php
20042
0644
edit
dl
rm
ProductAttribute.php
1241
0644
edit
dl
rm
ProductAttributeSet.php
1333
0644
edit
dl
rm
ProductAttributeSetTranslation.php
504
0644
edit
dl
rm
ProductAttributeTranslation.php
493
0644
edit
dl
rm
ProductCategory.php
2441
0644
edit
dl
rm
ProductCategoryTranslation.php
514
0644
edit
dl
rm
ProductCollection.php
1445
0644
edit
dl
rm
ProductCollectionTranslation.php
495
0644
edit
dl
rm
ProductLabel.php
579
0644
edit
dl
rm
ProductLabelTranslation.php
480
0644
edit
dl
rm
ProductTag.php
883
0644
edit
dl
rm
ProductTranslation.php
504
0644
edit
dl
rm
ProductVariation.php
2078
0644
edit
dl
rm
ProductVariationItem.php
1016
0644
edit
dl
rm
Review.php
1192
0644
edit
dl
rm
Shipment.php
1763
0644
edit
dl
rm
ShipmentHistory.php
1064
0644
edit
dl
rm
Shipping.php
906
0644
edit
dl
rm
ShippingRule.php
1020
0644
edit
dl
rm
ShippingRuleItem.php
868
0644
edit
dl
rm
StoreLocator.php
746
0644
edit
dl
rm
Tax.php
535
0644
edit
dl
rm
Wishlist.php
630
0644
edit
dl
rm
Edit:
/home/techb158/immovalet.com/platform/plugins/ecommerce/src/Models/Discount.php
(1992B)
<?php namespace Botble\Ecommerce\Models; use Botble\Base\Models\BaseModel; use Illuminate\Database\Eloquent\Relations\BelongsToMany; class Discount extends BaseModel { /** * @var string */ protected $table = 'ec_discounts'; /** * @var array */ protected $fillable = [ 'title', 'code', 'start_date', 'end_date', 'quantity', 'total_used', 'value', 'type', 'can_use_with_promotion', 'type_option', 'target', 'min_order_price', 'discount_on', 'product_quantity', ]; /** * @var array */ protected $dates = [ 'start_date', 'end_date', 'created_at', 'updated_at', ]; /** * @return bool */ public function isExpired() { if ($this->end_date && strtotime($this->end_date) < strtotime(now()->toDateTimeString())) { return true; } return false; } /** * @return BelongsToMany */ public function productCollections() { return $this->belongsToMany( ProductCollection::class, 'ec_discount_product_collections', 'discount_id', 'product_collection_id' ); } /** * @return BelongsToMany */ public function customers() { return $this->belongsToMany(Customer::class, 'ec_discount_customers', 'discount_id', 'customer_id'); } /** * @return BelongsToMany */ public function products() { return $this->belongsToMany(Product::class, 'ec_discount_products', 'discount_id', 'product_id'); } protected static function boot() { parent::boot(); static::deleting(function (Discount $discount) { $discount->productCollections()->detach(); $discount->customers()->detach(); $discount->products()->detach(); }); } }
Save
cmd:
run