45 lines
1.2 KiB
PHP
45 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class ScreeningLotteryRequest 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_lottery_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',
|
|
];
|
|
}
|
|
|
|
public function messages()
|
|
{
|
|
return [
|
|
'screening_lottery_catalog_id.required' => '請勾選篩檢項目',
|
|
'id_number' => '身份證格式不正確',
|
|
'phone.regex' => '手機格式不正確',
|
|
'birth.date_format' => '出生年月日格式不正確',
|
|
];
|
|
}
|
|
}
|