I have html-form that contains arrays. It has such structure:
"q" => array:1 [▼
"new" => array:1 [▼
1 => array:2 [▼
"name" => "a"
"v" => array:2 [▼
1 => array:1 [▼
"text" => "b"
]
2 => array:1 [▼
"text" => "c"
]
]
]
]
]
I've created form request. And now it has one rule:
'q.new.*.v.*.text' => 'required|min:2|max:128'
And do you know what? Sometimes it works. When q.new.*.v
array contains less than 4 elements everything validates just fine (I can see error messages). But when i send for example such form,
data is not flashed to storage and i can not retrieve it using old()
function. Image.
Some debug information:
[2020-02-06 22:37:51] local.INFO: Request all in form request: Array
(
[q] => Array
(
[new] => Array
(
[1] => Array
(
[name] => a
[v] => Array
(
[1] => Array
(
[text] => b
)
[2] => Array
(
[text] => c
)
[3] => Array
(
[text] => d
)
[4] => Array
(
[text] => e
)
)
)
)
)
)
[2020-02-06 22:37:51] local.INFO: Old() in form request: Array
(
)
[2020-02-06 22:37:51] local.INFO: Old in controller after redirect: Array
(
)
[2020-02-06 22:37:51] local.INFO: Request all in controller after redirect: Array
(
)
I've tried to transform q.new.*.v.*.text
into array of q.new.1.v.1.text
, q.new.1.v.2.text
, q.new.1.v.3.text
, but that didn't give much results.