| 123456789101112131415161718192021222324252627 |
- <?php
- namespace App;
- use Illuminate\Database\Eloquent\Model;
- class StationTask extends Model
- {
- protected $fillable = ['status'];
- public function taskCommodities()
- { //任务商品列表
- return $this->belongsToMany(StationTaskCommodity::class,"station_task_children","station_task_id","station_task_table_id")
- ->where("station_task_table_type","station_task_commodities");
- }
- public function taskBatches()
- { //任务波次 目前为单个,取值时应取第一个即可
- return $this->belongsToMany(StationTaskBatch::class,"station_task_children","station_task_id","station_task_table_id")
- ->where("station_task_table_type","station_task_batches");
- }
- public function taskMaterialBoxes()
- { //任务料箱
- return $this->belongsToMany(StationTaskMaterialBox::class,"station_task_children","station_task_id","station_task_table_id")
- ->where("station_task_table_type","station_task_material_boxes");
- }
- }
|