StationTask.php 769 B

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