/home/techb158/immovalet.com/platform/plugins/ecommerce/src/Models
Edit: /home/techb158/immovalet.com/platform/plugins/ecommerce/src/Models/Discount.php (1992B)
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();
});
}
}