70 lines
1.7 KiB
PHP
70 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class EventImprovedHealthRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*
|
|
* @return bool
|
|
*/
|
|
public function authorize()
|
|
{
|
|
// only allow updates if the user is logged in
|
|
//return backpack_auth()->check();
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function rules()
|
|
{
|
|
return [
|
|
'hospital_name' => 'required|min:2',
|
|
'name' => 'required|min:1|max:128',
|
|
'twid' => 'required|isNI',
|
|
'phone' => 'required|phone:TW',
|
|
'email' => 'required|email',
|
|
'address' => 'required|min:5',
|
|
'check_reson' => 'required_if:check_state,3',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get the validation attributes that apply to the request.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function attributes()
|
|
{
|
|
return [
|
|
'hospital_name' => '就醫院所',
|
|
'name' => '姓名',
|
|
'twid' => '身份證字號',
|
|
'phone' => '行動電話',
|
|
'email' => '電子信箱',
|
|
'address' => '收件地址'
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get the validation messages that apply to the request.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function messages()
|
|
{
|
|
return [
|
|
'twid.is_n_i' => '身份證字號驗證有誤',
|
|
'phone.phone' => '行動電話驗證有誤',
|
|
'check_reson.required_if' => '當審核狀態為「未通過」時,必需填寫「審核回應」欄位'
|
|
];
|
|
}
|
|
}
|