我有一个自定义验证规则
'title' => ['required', 'min:3', 'unique:transport_locations,title,NULL,id,deleted_at,NULL', new TransportLocationIsInactive],
我想在进行唯一检查之前运行我的自定义规则
'unique:transport_locations,title,NULL,id,deleted_at,NULL'
问题是,它总是首先运行唯一检查,并返回“位置名称已被使用。” :-(
只需更改顺序
'title' => [
'required', // 1
'min:3', // 2
new TransportLocationIsInactive, // 3
'unique:transport_locations,title,NULL,id,deleted_at,NULL', // 4
],