Validation rules required_if with other condition (Laravel 5.4)

后端 未结 4 1818
逝去的感伤
逝去的感伤 2021-02-20 09:38

I got a problem with validation rules with nested conditions.

class StoreRequest extends Request
{
        public function authorize(){
        return true;
             


        
4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-20 10:06

    try this pass the value directly refer: https://www.npmjs.com/package/validatorjs

    "required_if:anotherfield,value"

    The field under validation must be present and not empty if the anotherfield field is equal to any value.

    'type_id' => 'required|integer', 'external_id' => 'required_if:type_i,3|integer',

提交回复
热议问题