ProductGroupedProduct.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace Webkul\Product\Models;
  3. use Illuminate\Database\Eloquent\Factories\Factory;
  4. use Illuminate\Database\Eloquent\Factories\HasFactory;
  5. use Illuminate\Database\Eloquent\Model;
  6. use Webkul\Product\Contracts\ProductGroupedProduct as ProductGroupedProductContract;
  7. use Webkul\Product\Database\Factories\ProductGroupedProductFactory;
  8. class ProductGroupedProduct extends Model implements ProductGroupedProductContract
  9. {
  10. use HasFactory;
  11. /**
  12. * Set timestamp false.
  13. *
  14. * @var bool
  15. */
  16. public $timestamps = false;
  17. /**
  18. * Add fillable property to the model.
  19. *
  20. * @var array
  21. */
  22. protected $fillable = [
  23. 'qty',
  24. 'sort_order',
  25. 'product_id',
  26. 'associated_product_id',
  27. ];
  28. /**
  29. * Get the product that owns the image.
  30. */
  31. public function product()
  32. {
  33. return $this->belongsTo(ProductProxy::modelClass());
  34. }
  35. /**
  36. * Get the product that owns the image.
  37. */
  38. public function associated_product()
  39. {
  40. return $this->belongsTo(ProductProxy::modelClass());
  41. }
  42. /**
  43. * Create a new factory instance for the model.
  44. */
  45. protected static function newFactory(): Factory
  46. {
  47. return ProductGroupedProductFactory::new();
  48. }
  49. }