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.
51 lines
960 B
PHP
51 lines
960 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Contracts\Validation\Validator;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Yo;
|
|
|
|
class EditConfigInput 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 [
|
|
'label' => ['required', 'between:1,50'],
|
|
'value' => ['required', 'between:1,1000'],
|
|
'remark' => ['between:0,100'],
|
|
];
|
|
}
|
|
|
|
public function messages()
|
|
{
|
|
return [
|
|
'label.required' => 100011,
|
|
'label.between' => 100024,
|
|
'value.required' => 100025,
|
|
'value.between' => 100026,
|
|
'remark.between' => 100013,
|
|
];
|
|
}
|
|
|
|
public function failedValidation(Validator $validator)
|
|
{
|
|
Yo::error_echo($validator->errors()->first());
|
|
}
|
|
}
|