StationTask.php 830 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace App;
  3. use Illuminate\Database\Eloquent\Model;
  4. use App\Traits\LogModelChanging;
  5. class StationTask extends Model
  6. {
  7. use LogModelChanging;
  8. protected $fillable = ['status'];
  9. public function tasks()
  10. {
  11. return $this->morphTo();
  12. }
  13. public function stationTaskCommodities()
  14. { //任务商品列表
  15. return $this->morphTo()->where("station_task_table_type","station_task_commodities");
  16. }
  17. public function stationTaskBatches()
  18. { //任务波次 目前为单个,取值时应取第一个即可
  19. return $this->morphTo()->where("station_task_table_type","station_task_batches");
  20. }
  21. public function stationTaskMaterialBoxes()
  22. { //任务料箱
  23. return $this->morphTo()->where("station_task_table_type","station_task_material_boxes");
  24. }
  25. }