ProductBundleOption.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace Webkul\Product\Models;
  3. use Illuminate\Database\Eloquent\Factories\Factory;
  4. use Illuminate\Database\Eloquent\Factories\HasFactory;
  5. use Webkul\Core\Eloquent\TranslatableModel;
  6. use Webkul\Product\Contracts\ProductBundleOption as ProductBundleOptionContract;
  7. use Webkul\Product\Database\Factories\ProductBundleOptionsFactory;
  8. class ProductBundleOption extends TranslatableModel implements ProductBundleOptionContract
  9. {
  10. use HasFactory;
  11. /**
  12. * Set timestamp false.
  13. *
  14. * @var bool
  15. */
  16. public $timestamps = false;
  17. /**
  18. * Add the translateable attribute.
  19. *
  20. * @var array
  21. */
  22. public $translatedAttributes = ['label'];
  23. /**
  24. * Add fillable property to the model.
  25. *
  26. * @var array
  27. */
  28. protected $fillable = [
  29. 'type',
  30. 'is_required',
  31. 'sort_order',
  32. 'product_id',
  33. ];
  34. /**
  35. * Get the product that owns the image.
  36. */
  37. public function product()
  38. {
  39. return $this->belongsTo(ProductProxy::modelClass());
  40. }
  41. /**
  42. * Get the bundle option products that owns the bundle option.
  43. */
  44. public function bundle_option_products()
  45. {
  46. return $this->hasMany(ProductBundleOptionProductProxy::modelClass());
  47. }
  48. /**
  49. * Create a new factory instance for the model.
  50. */
  51. protected static function newFactory(): Factory
  52. {
  53. return ProductBundleOptionsFactory::new();
  54. }
  55. }