ProjectRequest.php 1.5 KB
<?php

namespace App\Http\Requests\Aside\Project;

use App\Rules\Mobile;
use Illuminate\Foundation\Http\FormRequest;

/**
 * Class ProjectRequest
 * @package App\Http\Requests\Aside\product
 * @author zbj
 * @date 2023/4/25
 */
class ProjectRequest 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 [
//            'id' => 'required',
//            'title' => 'max:100',
//            'company' => 'max:100',
//            'lead_name' => 'max:20',
//            'mobile' => [new Mobile()],
//            'qq' => 'max:20',
//            'cooperate_date' => 'date_format:Y-m-d',
//            'province' => 'max:20',
//            'city' => 'max:20',
        ];
    }

    public function messages()
    {
        return [
            'id.required' => 'ID不能为空',
            'title.max' => '项目名称不能超过100个字符',
            'company.max' => '公司名不能超过100个字符',
            'lead_name.max' => '联系人不能超过20个字符',
            'qq.max' => 'QQ号不能超过20个字符',
            'cooperate_date.date_format' => '合作时间格式不正确',
            'province.max' => '省份不能超过20个字符',
            'city.max' => '城市不能超过20个字符',
        ];
    }

}