v2board/app/Http/Requests/Admin/TutorialSave.php

36 lines
851 B
PHP
Raw Normal View History

2020-01-02 21:38:32 +08:00
<?php
namespace App\Http\Requests\Admin;
use Illuminate\Foundation\Http\FormRequest;
class TutorialSave extends FormRequest
{
2020-02-18 22:06:54 +08:00
CONST RULES = [
'title' => 'required',
'category' => 'required|in:windows,macos,ios,android,linux,router',
'description' => 'required',
'icon' => 'required'
];
2020-01-02 21:38:32 +08:00
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
2020-02-18 22:06:54 +08:00
return self::RULES;
2020-01-02 21:38:32 +08:00
}
2020-01-11 13:36:52 +08:00
2020-01-02 21:38:32 +08:00
public function messages()
{
return [
'title.required' => '标题不能为空',
2020-02-18 22:06:54 +08:00
'category.required' => '分类不能为空',
'category.in' => '分类格式不正确',
2020-01-02 21:38:32 +08:00
'description.required' => '描述不能为空',
2020-01-02 21:49:04 +08:00
'icon.required' => '图标不能为空'
2020-01-02 21:38:32 +08:00
];
}
}