海南旅游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.

38 lines
711 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. public function __construct(array $attributes = [])
  9. {
  10. parent::__construct($attributes);
  11. //$this->timestamps = false;
  12. }
  13. public function order()
  14. {
  15. return $this->belongsTo(Order::class,'order_id','id');
  16. }
  17. public function product()
  18. {
  19. return $this->belongsTo(Product::class,'product_id','id');
  20. }
  21. public function supplier()
  22. {
  23. return $this->belongsTo(Supplier::class)->withTrashed();
  24. }
  25. public function agent()
  26. {
  27. return $this->belongsTo(Agent::class)->withTrashed();
  28. }
  29. }