2017-10-28 100 views
0

如果account_name字段不具有值“0”,那么我需要一个字段项目。我想要验证此方案在laravel如果其他字段没有特定值,则为必填字段

eg if account_name = '0' -project_name field is not required 
    if account_name = '1' - project_name field is required 


$this->validate($request,[ 
    'project_name'=>'required_without:account_name,0', 
    ]); 

回答

2

尝试使用required_unless!那么名称将是必需的,除非account_name等于0.

​​
相关问题