You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.3 KiB
PHP

<?php
namespace App\Http\Requests;
use Illuminate\Contracts\Validation\Validator;
use Illuminate\Foundation\Http\FormRequest;
use Yo;
class EditHospitalInput extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => ['required', 'between:1,50'],
'code' => ['required', 'between:1,50'],
'address' => ['required', 'between:1,100'],
'longitude' => ['required'],
'latitude' => ['required'],
'logo' => ['required', 'between:1,100'],
'phone' => ['required', 'between:1,20'],
];
}
public function messages()
{
return [
'name.required' => 200001,
'name.between' => 200002,
'code.required' => 200003,
'code.between' => 200004,
'address.required' => 200005,
'address.between' => 200006,
'longitude.required' => 200007,
'latitude.required' => 200008,
'logo.required' => 200009,
'logo.between' => 200010,
'phone.required' => 200011,
'phone.between' => 200012,
];
}
public function failedValidation(Validator $validator)
{
Yo::error_echo($validator->errors()->first());
}
}