海南旅游SAAS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
797 B

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Factories\HasFactory;
  4. class OrderProductItem extends BaseModel
  5. {
  6. use HasFactory;
  7. protected $guarded = ['id']; //不允许批量赋值的字段
  8. protected $casts = ['agent_product_spec_id' => 'json', 'product_spec_id' => 'json'];
  9. public function __construct(array $attributes = [])
  10. {
  11. parent::__construct($attributes);
  12. //$this->timestamps = false;
  13. }
  14. public function order()
  15. {
  16. return $this->belongsTo(Order::class,'order_id','id');
  17. }
  18. public function product()
  19. {
  20. return $this->belongsTo(Product::class,'product_id','id');
  21. }
  22. public function supplier()
  23. {
  24. return $this->belongsTo(Supplier::class)->withTrashed();
  25. }
  26. public function agent()
  27. {
  28. return $this->belongsTo(Agent::class)->withTrashed();
  29. }
  30. }