Laravel - Validation - Excluding Unvalidated Array Keys

If you would like, you may instruct Laravel's validator to never include unvalidated array keys in the "validated" data it returns, even if you use the array rule without specifying a list of allowed keys. To accomplish this, you may call the validator's excludeUnvalidatedArrayKeys method in the boot method of your application's AppServiceProvider. After doing so, the validator will include array keys in the "validated" data it returns only when those keys were specifically validated by nested array rules:

    
    use Illuminate\Support\Facades\Validator;
    
    /**
     * Register any application services.
     *
     * @return void
     */
    public function boot()
    {
        Validator::excludeUnvalidatedArrayKeys();
    }