KeywordRequest.php 1.4 KB
<?php

namespace App\Http\Requests\Bside\Product;

use Illuminate\Foundation\Http\FormRequest;

/**
 * Class KeywordRequest
 * @package App\Http\Requests\Bside\product
 * @author zbj
 * @date 2023/4/15
 */
class KeywordRequest 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 [
            'title'=>'required|max:200',
//            'seo_title'=>'max:70',
            'seo_keywords'=>'max:300',
            'seo_description'=>'max:200',
            'related_news_ids'=>'array|max:2',
            'related_blog_ids'=>'array|max:2',
        ];
    }

    public function messages()
    {
        return [
            'title.required' => '请输入关键词',
            'title.max' => '关键词不能超过200个字符',
//            'seo_title.max' => 'SEO标题不能超过70个字符',
            'seo_keywords.max' => 'SEO关键词不能超过300个字符',
            'seo_description.max' => 'SEO描述不能超过200个字符',
            'related_news_ids.max' => '关联新闻不能超过两条',
            'related_blog_ids.max' => '关联博客不能超过两条',
        ];
    }

}