migrants-nt-sec/app/Http/Requests/UpdatePersonRequest.php

88 lines
3.6 KiB
PHP

<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdatePersonRequest 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.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
// Person validation rules
'surname' => 'nullable|string|max:100',
'christian_name' => 'nullable|string|max:100',
'full_name' => 'nullable|string|max:200',
'date_of_birth' => 'nullable|date',
'place_of_birth' => 'nullable|string|max:100',
'date_of_death' => 'nullable|date',
'occupation' => 'nullable|string|max:100',
'additional_notes' => 'nullable|string',
'reference' => 'nullable|string|max:100',
'id_card_no' => 'nullable|string|max:50',
// Migration validation rules
'migration' => 'nullable|array',
'migration.date_of_arrival_aus' => 'nullable|date',
'migration.date_of_arrival_nt' => 'nullable|date',
'migration.arrival_period' => 'nullable|string|max:50',
'migration.data_source' => 'nullable|string|max:100',
// Naturalization validation rules
'naturalization' => 'nullable|array',
'naturalization.date_of_naturalisation' => 'nullable|date',
'naturalization.no_of_cert' => 'nullable|string|max:50',
'naturalization.issued_at' => 'nullable|string|max:100',
// Residence validation rules
'residence' => 'nullable|array',
'residence.darwin' => 'nullable|boolean',
'residence.katherine' => 'nullable|boolean',
'residence.tennant_creek' => 'nullable|boolean',
'residence.alice_springs' => 'nullable|boolean',
'residence.home_at_death' => 'nullable|string|max:100',
// Family validation rules
'family' => 'nullable|array',
'family.names_of_parents' => 'nullable|string',
'family.names_of_children' => 'nullable|string',
// Internment validation rules
'internment' => 'nullable|array',
'internment.corps_issued' => 'nullable|string|max:100',
'internment.interned_in' => 'nullable|string|max:100',
'internment.sent_to' => 'nullable|string|max:100',
'internment.internee_occupation' => 'nullable|string|max:100',
'internment.internee_address' => 'nullable|string',
'internment.cav' => 'nullable|string|max:50',
// Photo validation rules
'photos' => 'nullable|array',
'photos.*' => 'nullable|file|image|max:10240', // Max 10MB per image
'captions' => 'nullable|array',
'captions.*' => 'nullable|string|max:255',
'main_photo_index' => 'nullable|integer|min:0',
'set_as_profile' => 'nullable|boolean',
'profile_photo_id' => 'nullable|exists:photos,id',
'remove_photos' => 'nullable|array',
'remove_photos.*' => 'nullable|exists:photos,id',
'existing_photos' => 'nullable|array',
'existing_photos.*.id' => 'nullable|exists:photos,id',
'existing_photos.*.caption' => 'nullable|string|max:255',
];
}
}