Validation

When working with forms, it is often necessary that the user's input data follows certain rules.
For instance when a field can not be empty or it needs to be unique (like a username) or a date field needs to be before or after a certain date, etc.

A form gets submitted with ajax with the help of the jQuery Form plugin.
On the server side, the data is validated against the Laravel validation rules witch returns an ajax response that is being handled with the jQuery Validation plugin.

Example

        
            'rules' => [
                    'title' => 'required|min:6',
                    'text' => 'required',
                    'transport' => 'required',
                    'start_date' => 'date|after:tomorrow',
                    'img' => 'required|image|dimensions:min_width=400,min_height=400',
                    'brand' => 'required',
                    'media' => 'required',
                    'social' => 'required|array|between:2,4',
                    'client' => 'required',          
                    'password' => 'required|min:6|confirmed|regex:/^(?=\S*[a-z])(?=\S*[A-Z])(?=\S*[\d])\S*$/',
            ]
        
    
select image change remove jpeg, png or gif. At least 400px wide X 400px tall

add new social media