- Labor 모델 (BelongsToTenant, SoftDeletes)
- LaborController 7개 엔드포인트
- LaborService 비즈니스 로직
- FormRequest 4개 (Index/Store/Update/BulkDelete)
- 마이그레이션 및 라우트 등록
API: GET/POST /labor, GET/PUT/DELETE /labor/{id}, DELETE /labor/bulk, GET /labor/stats
Co-Authored-By: Claude <noreply@anthropic.com>
38 lines
1.2 KiB
PHP
38 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Labor;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class LaborIndexRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'search' => ['nullable', 'string', 'max:100'],
|
|
'category' => ['nullable', 'string', 'in:가로,세로할증'],
|
|
'status' => ['nullable', 'string', 'in:사용,중지'],
|
|
'start_date' => ['nullable', 'date'],
|
|
'end_date' => ['nullable', 'date', 'after_or_equal:start_date'],
|
|
'page' => ['nullable', 'integer', 'min:1'],
|
|
'per_page' => ['nullable', 'integer', 'min:1', 'max:100'],
|
|
'sort_by' => ['nullable', 'string', 'in:created_at,labor_number,category,min_m,max_m,labor_price'],
|
|
'sort_dir' => ['nullable', 'string', 'in:asc,desc'],
|
|
];
|
|
}
|
|
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'category.in' => __('validation.in', ['attribute' => '구분']),
|
|
'status.in' => __('validation.in', ['attribute' => '상태']),
|
|
'end_date.after_or_equal' => __('validation.after_or_equal', ['attribute' => '종료일', 'date' => '시작일']),
|
|
];
|
|
}
|
|
}
|