- 캘린더 CRUD API, 배차차량 관리 API (CRUD + options) - 배차정보 다중 행 시스템 (shipment_vehicle_dispatches) - 설비 다중점검주기 + 부 담당자 스키마 추가 - TodayIssue 날짜 기반 조회, Stock/Client 날짜 필터 - i18n 메시지 추가 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
53 lines
1.1 KiB
PHP
53 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models\Tenants;
|
|
|
|
use App\Traits\Auditable;
|
|
use App\Traits\BelongsToTenant;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class ShipmentVehicleDispatch extends Model
|
|
{
|
|
use Auditable, BelongsToTenant, SoftDeletes;
|
|
|
|
protected $fillable = [
|
|
'tenant_id',
|
|
'shipment_id',
|
|
'seq',
|
|
'logistics_company',
|
|
'arrival_datetime',
|
|
'tonnage',
|
|
'vehicle_no',
|
|
'driver_contact',
|
|
'remarks',
|
|
'options',
|
|
];
|
|
|
|
protected $casts = [
|
|
'seq' => 'integer',
|
|
'shipment_id' => 'integer',
|
|
'arrival_datetime' => 'datetime',
|
|
'options' => 'array',
|
|
];
|
|
|
|
/**
|
|
* 출하 관계
|
|
*/
|
|
public function shipment(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Shipment::class);
|
|
}
|
|
|
|
/**
|
|
* 다음 순번 가져오기
|
|
*/
|
|
public static function getNextSeq(int $shipmentId): int
|
|
{
|
|
$maxSeq = static::where('shipment_id', $shipmentId)->max('seq');
|
|
|
|
return ($maxSeq ?? 0) + 1;
|
|
}
|
|
}
|