Files
GSB-Construction/Modules/DailyReports/app/Http/Requests/UpdateDailyReportRequest.php

66 lines
2.9 KiB
PHP

<?php
namespace Modules\DailyReports\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdateDailyReportRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*/
public function rules(): array
{
return [
'project_id' => ['required', 'exists:projects,id'],
'report_date' => ['required', 'date'], // Can't change to past, but existing might be past. Controller logic handles edits.
'report_number' => ['nullable', 'string', 'max:255'],
'temperature' => ['nullable', 'string', 'max:255'],
'precipitation' => ['nullable', 'string', 'max:255'],
'wind' => ['nullable', 'string', 'max:255'],
'weather' => ['nullable', 'string', 'max:255'],
'start_time' => ['nullable', 'date_format:H:i'],
'end_time' => ['nullable', 'date_format:H:i'],
'remarks' => ['nullable', 'string'],
'labors' => ['nullable', 'array'],
'labors.*.trade' => ['required_with:labors', 'string', 'max:255'],
'labors.*.workers_count' => ['required_with:labors', 'integer', 'min:1'],
'labors.*.hours' => ['nullable', 'numeric', 'min:0'],
'labors.*.notes' => ['nullable', 'string'],
'equipment' => ['nullable', 'array'],
'equipment.*.equipment_name' => ['required_with:equipment', 'string', 'max:255'],
'equipment.*.hours_used' => ['nullable', 'numeric', 'min:0'],
'equipment.*.status' => ['nullable', 'string', 'max:255'],
'activities' => ['nullable', 'array'],
'activities.*.task_name' => ['required_with:activities', 'string', 'max:255'],
'activities.*.quantity_completed' => ['nullable', 'string', 'max:255'],
'activities.*.percentage_completed' => ['nullable', 'numeric', 'min:0', 'max:100'],
'activities.*.zone_area' => ['nullable', 'string', 'max:255'],
'materials' => ['nullable', 'array'],
'materials.*.material_name' => ['required_with:materials', 'string', 'max:255'],
'materials.*.quantity_received' => ['nullable', 'string', 'max:255'],
'materials.*.condition' => ['nullable', 'string', 'max:255'],
'issues' => ['nullable', 'array'],
'issues.*.issue_type' => ['required_with:issues', 'string', 'max:255'],
'issues.*.description' => ['required_with:issues', 'string'],
'issues.*.delay_impact' => ['nullable', 'string', 'max:255'],
'attachments' => ['nullable', 'array'],
'attachments.*' => ['file', 'max:10240'],
];
}
}