Files
cmsi-kchb/app/Http/Requests/ScreeningAppointmentRequest.php
2025-06-13 12:29:06 +08:00

50 lines
1.5 KiB
PHP

<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class ScreeningAppointmentRequest 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 [
'screening_appointment_catalog_id' => 'required|array',
'id_number' => 'required|uppercase|max:10',
'name' => 'required',
'phone' => 'required|regex:/(09)[0-9]{8}/',
'email' => 'required|email',
'address' => 'required',
'birth' => 'required|date_format:Y/m/d',
'pre_order_time' => 'required|integer',
//'behaviors' => 'required|array',
//'history' => 'required|array',
];
}
public function messages()
{
return [
'screening_appointment_catalog_id.required' => '請勾選檢查項目',
'id_number' => '身份證格式不正確',
'phone.regex' => '手機格式不正確',
'birth.date_format' => '出生年月日格式不正確',
//'behaviors.required' => '請勾選健康習慣',
//'history.required' => '請勾選是否曾接受過四癌篩檢?',
];
}
}