StationTaskBatch.php 636 B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace App;
  3. use Illuminate\Database\Eloquent\Model;
  4. use Illuminate\Database\Eloquent\Relations\HasOne;
  5. use Illuminate\Database\Eloquent\Relations\MorphOne;
  6. class StationTaskBatch extends ModelExtended
  7. {
  8. protected $fillable=['batch_id','station_id','station_task_batch_type_id','status'];
  9. function station(): HasOne
  10. {
  11. return $this->hasOne(Station::class);
  12. }
  13. function stationTask(): MorphOne
  14. {
  15. return $this->morphOne(StationTask::class,'station_taskable');
  16. }
  17. public function batch(): HasOne
  18. { //波次
  19. return $this->hasOne(Batch::class,"id","batch_id");
  20. }
  21. }