| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- namespace App;
- use Illuminate\Database\Eloquent\Model;
- use Illuminate\Database\Eloquent\Relations\BelongsTo;
- use Illuminate\Database\Eloquent\Relations\HasMany;
- use Illuminate\Database\Eloquent\Relations\HasManyThrough;
- use Illuminate\Database\Eloquent\Relations\HasOne;
- use Illuminate\Database\Eloquent\Relations\MorphOne;
- use App\Traits\ModelLogChanging;
- class StationTaskBatch extends Model
- {
- use ModelLogChanging;
- protected $fillable=['batch_id','station_id','station_task_batch_type_id','status'];
- function station(): BelongsTo
- {
- return $this->belongsTo(Station::class);
- }
- function stationTask(): BelongsTo
- {
- return $this->belongsTo(StationTask::class);
- }
- public function batch(): BelongsTo
- { //波次
- return $this->belongsTo(Batch::class);
- }
- function stationTaskCommodities(): HasMany
- {
- return $this->hasMany(StationTaskCommodity::class);
- }
- function stationTaskMaterialBoxes(): HasMany
- {
- return $this->hasMany(StationTaskMaterialBox::class);
- }
- function materialBoxes(): HasManyThrough
- {
- return $this->hasManyThrough(
- MaterialBox::class,
- StationTaskMaterialBox::class,
- 'station_task_batch_id',
- 'id',
- 'id',
- 'material_box_id'
- );
- }
- }
|