We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This is the rquest body:
{ "arr": [ { "a": 3, "b": 3 }, { "a": 3, "b": 3 } ] }
and with this validations rules:
public function rules() { return [ // 'arr' => 'array', 'arr.*.a' => 'required' ]; }
The result of dd($request->validated()); is what I want, I don't need b to be included
dd($request->validated());
b
"arr" => array:2 [ 0 => array:1 [ "a" => 3 ] 1 => array:1 [ "a" => 3 ] ]
But when I want to validate the array itself like this:
public function rules() { return [ 'arr' => 'array', 'arr.*.a' => 'required' ]; }
b will be added to the output
"arr" => array:2 [ 0 => array:1 [ "a" => 3, "b" => 3 ] 1 => array:1 [ "a" => 3, "b" => 3 ] ]
There is no way to exclue b from the array and it will cause the following error:
Message SQLSTATE[42S22]: Column not found: 1054 Unknown column 'base_require' in 'field list' (SQL: insert into product_variation_unit (base, base_require, max, min, name, product_variation_id, unit_id) values (1000, ?, 10000, 1000, کیلو, 2036, 1)) Level ERROR Exception { "class": "Illuminate\\Database\\QueryException", "message": "SQLSTATE[42S22]: Column not found: 1054 Unknown column 'base_require' in 'field list' (SQL: insert into product_variation_unit (base, base_require, max, min, name, product_variation_id, unit_id) values (1000, ?, 10000, 1000, \u06a9\u06cc\u0644\u0648, 2036, 1))", "code": "42S22",
Discussion about it: https://stackoverflow.com/questions/58851288/using-validated-method-with-array-in-laravel
The text was updated successfully, but these errors were encountered:
No branches or pull requests
This is the rquest body:
and with this validations rules:
The result of
dd($request->validated());
is what I want, I don't needb
to be includedBut when I want to validate the array itself like this:
b
will be added to the outputThere is no way to exclue
b
from the array and it will cause the following error:Discussion about it: https://stackoverflow.com/questions/58851288/using-validated-method-with-array-in-laravel
The text was updated successfully, but these errors were encountered: