0

I've an owners table with a user_id field, this field can be NULL. because not every owner may have an user account. I need to check if the user_id field is NULL on the owners table, before creating a user and updating that table. How do I do it with Laravel's Validation ?

1 Answer 1

1

You can extend the validator, as per the docs

Validator::extend('foo', function($attribute, $value, $parameters)
{
    return $value == NULL;
});

See the custom validation section http://four.laravel.com/docs/validation

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.