I just want to ensure that my data, coming from a JS side, is an array. So from the accepted answer it is visible that writing 'array'
in the validation would be enough. But in my case, when I write:
$request->validate([
'tags' => 'array',
]);
and pass an array [1,2,3]
using Postman, I get an error ["The tags must be an array."]
, and php handles it as a string, so when I try to get, for example, the first element $request->tags[0]
, I receive '['
. What's wrong here?