first commit
This commit is contained in:
69
app/Http/Requests/EventMetabolismRequest.php
Normal file
69
app/Http/Requests/EventMetabolismRequest.php
Normal file
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class EventMetabolismRequest 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' => '當審核狀態為「未通過」時,必需填寫「審核回應」欄位'
|
||||
];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user