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, ], ], ]