cac
1 year ago
493
9
Laravel

Forcing A Unique Rule To Ignore A Field Other Than ID

Posted 1 year ago by cac

Hi guys. I need help doing a validation. I am using a custom http request. these are the rules:

 $rules = [
            'name' => 'required|max:191|string',
            'ssn' => 'required|string|max:11|unique:people,ssn,' . $this->request->get('ssn'),
            'birthday' => 'required|date',
            'address' => 'nullable|string|max:191',
            'gender' => 'required|string|max:191'
        ];

But it still give me the message that the ssn has already been taken. Any thoughts on this?

Please sign in or create an account to participate in this conversation.