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

34 lines
743 B
PHP
Raw Normal View History

2019-12-12 13:45:46 +08:00
<?php
namespace App\Http\Requests\Admin;
use Illuminate\Foundation\Http\FormRequest;
class NoticeSave extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'title' => 'required',
2019-12-12 16:29:35 +08:00
'content' => 'required',
2022-04-15 02:45:52 +08:00
'img_url' => 'nullable|url',
'tags' => 'nullable|array'
2019-12-12 13:45:46 +08:00
];
}
2020-01-11 13:36:52 +08:00
2019-12-12 13:45:46 +08:00
public function messages()
{
return [
'title.required' => '标题不能为空',
2019-12-12 16:29:35 +08:00
'content.required' => '内容不能为空',
2022-04-15 02:45:52 +08:00
'img_url.url' => '图片URL格式不正确',
'tags.array' => '标签格式不正确'
2019-12-12 13:45:46 +08:00
];
}
}