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.

57 lines
1.1 KiB
PHP

<?php
namespace App\Http\Requests;
use Illuminate\Contracts\Validation\Validator;
use Illuminate\Foundation\Http\FormRequest;
use Yo;
class EditCarouselInput 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,20'],
'image' => ['required', 'between:1,200'],
'desc' => ['between:0,50'],
'jump_path' => ['between:0,200'],
'start_time' => ['required'],
'end_time' => ['required'],
];
}
public function messages()
{
return [
'name.required' => 200025,
'name.between' => 200026,
'image.required' => 200027,
'image.between' => 200028,
'desc.between' => 200030,
'jump_path.between' => 200029,
'start_time.required' => 200017,
'end_time.required' => 200018,
];
}
public function failedValidation(Validator $validator)
{
Yo::error_echo($validator->errors()->first());
}
}