Laravel-admin 表单提交验证俩个以上的唯一值
$name = isset(request()->all()['name']) ? request()->all()['name'] : ''; $id = isset(request()->route()->parameters['car']) ? request()->route()->parameters['car'] : ''; $form->select('a_id', 'a_id')->options('/admin/xx') ->creationRules(['required', "unique:cars,a_id,NULL,NULL,name,{$name}"], ['unique' => '数据已存在']) ->updateRules(['required', "unique:cars,a_id,{$id},id,name,{$name}"], ['unique' => '数据已存在']);
谢谢小伙伴们提出的建议,联系邮箱:2226785211@qq.com