| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- namespace Webkul\Product\Models;
- use Illuminate\Database\Eloquent\Factories\Factory;
- use Illuminate\Database\Eloquent\Factories\HasFactory;
- use Illuminate\Database\Eloquent\Model;
- use Webkul\Customer\Models\CustomerGroupProxy;
- use Webkul\Product\Contracts\ProductCustomerGroupPrice as ProductCustomerGroupPriceContract;
- use Webkul\Product\Database\Factories\ProductCustomerGroupPriceFactory;
- class ProductCustomerGroupPrice extends Model implements ProductCustomerGroupPriceContract
- {
- use HasFactory;
- /**
- * Add fillable property to the model.
- *
- * @var array
- */
- protected $fillable = [
- 'qty',
- 'value_type',
- 'value',
- 'priceable_id',
- 'priceable_type',
- 'customer_group_id',
- 'unique_id',
- ];
- /**
- * Get the owning priceable model (Product or ProductVariant).
- */
- public function priceable()
- {
- return $this->morphTo();
- }
- /**
- * Get the product that owns the customer group price.
- */
- public function customer_group()
- {
- return $this->belongsTo(CustomerGroupProxy::modelClass());
- }
- /**
- * Create a new factory instance for the model.
- */
- protected static function newFactory(): Factory
- {
- return ProductCustomerGroupPriceFactory::new();
- }
- }
|