41 lines
937 B
PHP
41 lines
937 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class ActivitiesParticipantRequest 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 [
|
|
'id_number' => 'required|uppercase|min:10|max:10',
|
|
'name' => 'required',
|
|
'phone' => 'required|regex:/(09)[0-9]{8}/',
|
|
'email' => 'required|email',
|
|
];
|
|
}
|
|
|
|
public function messages()
|
|
{
|
|
return [
|
|
|
|
'id_number' => '身份證格式不正確',
|
|
'phone.regex' => '手機格式不正確',
|
|
];
|
|
}
|
|
}
|