MrRobot21
2 years ago

Right Way to validate form input fields

Posted 2 years ago by MrRobot21

Hi Awesome People

i'm building an API, one of the db table Person have 52 columns and most of them are required my feeling is that the way i'm doing is not right

    public function store() 
    {
        if (! input::get('name') or ! input::get('age') or ! input::get('phone') or ! input::get('address') and so on till the 52 field) {
            return "Unprocessable Entity";
        }

        return "Validated";
    }

And how to properly validate all the required fields

Thank You

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