2026-01-08 20:17:40 +09:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Requests\Order;
|
|
|
|
|
|
|
|
|
|
use App\Models\Production\WorkOrder;
|
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
|
use Illuminate\Validation\Rule;
|
|
|
|
|
|
|
|
|
|
class CreateProductionOrderRequest extends FormRequest
|
|
|
|
|
{
|
|
|
|
|
public function authorize(): bool
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function rules(): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
2026-01-16 10:59:51 +09:00
|
|
|
'process_id' => 'nullable|integer|exists:processes,id',
|
|
|
|
|
'process_ids' => 'nullable|array',
|
|
|
|
|
'process_ids.*' => 'integer|exists:processes,id',
|
|
|
|
|
'priority' => 'nullable|string',
|
2026-01-08 20:17:40 +09:00
|
|
|
'process_type' => ['nullable', Rule::in(WorkOrder::PROCESS_TYPES)],
|
|
|
|
|
'assignee_id' => 'nullable|integer|exists:users,id',
|
|
|
|
|
'team_id' => 'nullable|integer|exists:departments,id',
|
|
|
|
|
'scheduled_date' => 'nullable|date',
|
|
|
|
|
'memo' => 'nullable|string',
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function messages(): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'process_type.in' => __('validation.in', ['attribute' => '공정 유형']),
|
|
|
|
|
'assignee_id.exists' => __('validation.exists', ['attribute' => '담당자']),
|
|
|
|
|
'team_id.exists' => __('validation.exists', ['attribute' => '팀']),
|
|
|
|
|
'scheduled_date.date' => __('validation.date', ['attribute' => '예정일']),
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|