StationTaskBatch.php 689 B

123456789101112131415161718192021222324252627282930
  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. use App\Traits\LogModelChanging;
  7. class StationTaskBatch extends Model
  8. {
  9. use LogModelChanging;
  10. protected $fillable=['batch_id','station_id','station_task_batch_type_id','status'];
  11. function station(): HasOne
  12. {
  13. return $this->hasOne(Station::class);
  14. }
  15. function stationTask(): MorphOne
  16. {
  17. return $this->morphOne(StationTask::class,'station_taskable');
  18. }
  19. public function batch(): HasOne
  20. { //波次
  21. return $this->hasOne(Batch::class,"id","batch_id");
  22. }
  23. }