Laravel validation exists where NOT

后端 未结 6 1887
温柔的废话
温柔的废话 2021-02-04 04:58

Based on the documentations. Exists can have 4 parameters:

exists:table,id,where,0

The question is, What if I wanted it to be where is not. Lik

6条回答
  •  心在旅途
    2021-02-04 05:40

    You can use unique

    Example

    'email' => 'unique:users,email_address,NULL,id,account_id,1'
    

    In the rule above, only rows with an account_id of 1 would be included in the unique check.

    http://laravel.com/docs/4.2/validation#rule-unique

提交回复
热议问题