2020-01-02 21:38:32 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Requests\Admin;
|
|
|
|
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
|
|
|
|
class TutorialSave extends FormRequest
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Get the validation rules that apply to the request.
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function rules()
|
|
|
|
{
|
2020-07-15 15:57:12 +08:00
|
|
|
return [
|
|
|
|
'title' => 'required',
|
|
|
|
// 1:windows 2:macos 3:ios 4:android 5:linux 6:router
|
|
|
|
'category_id' => 'required|in:1,2,3,4,5,6',
|
|
|
|
'steps' => 'required'
|
|
|
|
];
|
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:48:00 +08:00
|
|
|
'category_id.required' => '分类不能为空',
|
|
|
|
'category_id.in' => '分类格式不正确',
|
2020-02-25 09:56:06 +08:00
|
|
|
'steps.required' => '教程步骤不能为空'
|
2020-01-02 21:38:32 +08:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|