[ 'required', 'Integer', "gt:0", function ($attribute, $value, $fail) { $has = DB::table('videos')->where('id', $value)->first(); if (empty($has)) { $fail("短剧不不正确"); exit(); } if ($has->shelf_type != 2){ $fail("短剧未上架"); } } ], 'title' => ['required'] , 'miniprogram_type' => ['required','Integer',"in:1,2"] , 'status' => ['required','Integer',"in:0,1"] , "sort" => ['Integer',"gte:0"], 'img_url'=>[ 'required' ] ]; } /** * messages * * @return string[] */ public function messages(): array { return [ 'video_id.required' => '请选择短剧', 'title' => '名称必填', 'miniprogram_type' => '小程序类型不正确', 'img_url' => '请上传图片', 'status' => '状态值不正确', ]; } }