You can add custom rules to check the value of an integer array type
Just open the file
/resources/lang/en/validation.php
Add a custom message before the “received” message in the file.
'numericarray' => 'The :attribute must be numeric array value.', "accepted" => "The :attribute must be accepted.",
Now open the file
/app/Providers/AppServiceProvider.php
and then add custom validation in the download function.
public function boot() { $this->app['validator']->extend('numericarray', function ($attribute, $value, $parameters) { foreach ($value as $v) { if (!is_int($v)) { return false; } } return true; }); }
Now you can use numericarray to check the value of an integer array type
$this->validate($request, [ 'field_name1' => 'required', 'field_name2' => 'numericarray' ]);
source share