Since the early days, Laravel includes an excellent validator class. Laravel's validator works on any arbitrary array of data but it's typically used for request validation.

When passing an invalid payload array as our input, the validator will fail and provide us with a couple of validation messages: $data = [ 'name' => 'Ruben Van Assche', 'team' => [ 'id' => 2023, 'role' => 'ceo'

Let's take a look at the previous inputs we provided to the validator: [ 'name' => 'Ruben Van Assche', ]; No validation messages 👍 [ 'name' => 'Ruben Van Assche', 'team' => [ 'id' => 1, 'role' => 'engineer', ], ] Also no validation messages 🥳 [ 'name' => 'Ruben Van Assche', 'team' => [ 'id' => 1, 'role' => 'engineer', 'features' => [ 'github' => true, 'jira' => false, ], ], ]
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners