CartShippingRate.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace Webkul\Checkout\Models;
  3. use Illuminate\Database\Eloquent\Factories\Factory;
  4. use Illuminate\Database\Eloquent\Factories\HasFactory;
  5. use Illuminate\Database\Eloquent\Model;
  6. use Webkul\Checkout\Contracts\CartShippingRate as CartShippingRateContract;
  7. use Webkul\Checkout\Database\Factories\CartShippingRateFactory;
  8. class CartShippingRate extends Model implements CartShippingRateContract
  9. {
  10. use HasFactory;
  11. /**
  12. * Fillable property of the model.
  13. *
  14. * @var array
  15. */
  16. protected $fillable = [
  17. 'carrier',
  18. 'carrier_title',
  19. 'method',
  20. 'method_title',
  21. 'method_description',
  22. 'price',
  23. 'base_price',
  24. 'discount_amount',
  25. 'base_discount_amount',
  26. 'tax_percent',
  27. 'tax_amount',
  28. 'base_tax_amount',
  29. 'price_incl_tax',
  30. 'base_price_incl_tax',
  31. 'applied_tax_rate',
  32. ];
  33. /**
  34. * Get the post that owns the comment.
  35. */
  36. public function shipping_address()
  37. {
  38. return $this->belongsTo(CartAddressProxy::modelClass(), 'cart_address_id')
  39. ->where('address_type', CartAddress::ADDRESS_TYPE_SHIPPING);
  40. }
  41. /**
  42. * Create a new factory instance for the model
  43. */
  44. protected static function newFactory(): Factory
  45. {
  46. return CartShippingRateFactory::new();
  47. }
  48. }