DeliveryAppointment.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace App;
  3. use Illuminate\Database\Eloquent\Model;
  4. use App\Traits\ModelLogChanging;
  5. class DeliveryAppointment extends Model
  6. {
  7. use ModelLogChanging;
  8. protected $fillable=[
  9. "user_id",
  10. "owner_id",
  11. "procurement_number",
  12. "asn_number",
  13. "warehouse_id",
  14. "tonne",
  15. "cubic_meter",
  16. "box_amount",
  17. "capacity",
  18. "appointment_date",
  19. "date_period",
  20. "status",
  21. ];
  22. public function cars()
  23. { //车辆
  24. return $this->hasMany(DeliveryAppointmentCar::class,"delivery_appointment_id","id");
  25. }
  26. public function details()
  27. { //明细
  28. return $this->hasMany(DeliveryAppointmentDetail::class);
  29. }
  30. public function user()
  31. { //用户
  32. return $this->belongsTo(User::class);
  33. }
  34. public function owner()
  35. { //货主
  36. return $this->belongsTo(Owner::class);
  37. }
  38. public function warehouse()
  39. { //仓库
  40. return $this->belongsTo(Warehouse::class);
  41. }
  42. }