| 123456789101112131415161718192021222324252627282930 |
- <?php
- namespace App;
- use Illuminate\Database\Eloquent\Model;
- use Illuminate\Database\Eloquent\Relations\HasOne;
- use Illuminate\Database\Eloquent\Relations\MorphOne;
- use App\Traits\LogModelChanging;
- class StationTaskBatch extends Model
- {
- use LogModelChanging;
- protected $fillable=['batch_id','station_id','station_task_batch_type_id','status'];
- function station(): HasOne
- {
- return $this->hasOne(Station::class);
- }
- function stationTask(): MorphOne
- {
- return $this->morphOne(StationTask::class,'station_taskable');
- }
- public function batch(): HasOne
- { //波次
- return $this->hasOne(Batch::class,"id","batch_id");
- }
- }
|