Laravel 5.1。如何在' unique'中添加多个例外验证规则?

时间:2015-11-19 18:19:02

标签: validation laravel-5

例如,如何在下面的简单示例中添加异常$ id1和$ id2?

class SomeFormInputRequest extends Request
{
    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {   
        $id1 = 1;
        $id2 = 2
        return [
            'email' => 'email|unique:users,email,' . $id1,
        ];
    }
}

1 个答案:

答案 0 :(得分:0)

我认为您需要制作自己的验证器

http://laravel.com/docs/5.1/validation#custom-validation-rules