| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 | <?phpnamespace App\Http\Requests\Link;use App\Http\Requests\Request;use Illuminate\Validation\Rule;use Illuminate\Database\Query\Builder;class SaveRequest extends Request{    /**     * 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()    {        if (!$this->ajax()) {            return [];        }        return [            'type' => 'required',            'url' => [                'required',                Rule::unique('links')->where(function (Builder $query) {                    return $query->where('deleted_at', null);                })->ignore($this->route('id'))            ],            'remark' => 'nullable',            'tag' => 'nullable',            'cost' => 'nullable',            'business_ids' => 'nullable',            'country' => 'nullable',            'big_ball' => 'nullable',            'quantitative_restrictions' => 'nullable',            'phone_verification' => 'nullable',            'timed_release' => 'nullable',            'authority_score' => 'nullable',            'spam_score' => 'nullable',            'home_page' => 'nullable',        ];    }    public function attributes()    {        return [            'type' => '外链类型',            'url' => '平台链接',            'remark' => '备注',            'tag' => '标签',            'cost' => '费用',            'business_ids' => '行业',            'country' => '国家',            'big_ball' => '锚文本',            'quantitative_restrictions' => '数量限制',            'phone_verification' => '手机验证',            'timed_release' => '定时发布',            'authority_score' => 'authority score',            'spam_score' => 'spam score',            'home_page' => '个人主页加网址',        ];    }}
 |