使用 LARAVEL VALIDATION 时遇到一个问题。
我预计deleted_at
为空但我得deleted_at
= null
'level_name' => 'unique:company_levels,level_name,' . $id . ',id,company_id,' . $company_id.',deleted_at,null',
它会生成如下所示的查询
select count(*) as aggregate from `company_level` where `level_name` = 'Chennai' and `id` <> 1 and `company_id` = 3 and `deleted_at` = null
这不符合我的需要。
我需要生成如下所示的查询
select count(*) as aggregate from `company_level` where `level_name` = 'Chennai' and `id` <> 1 and `company_id` = 3 and `deleted_at` is null
先谢谢
答案 0 :(得分:0)
通过将null替换为NULL来解决问题。
使用 capital NULL替换null
退出查询
',deleted_at,null',
我用
替换了它',deleted_at,NULL',