Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
How to retrieve array element from validated method
  • Hello,
    Is it possible to retrieve array element via $val->validated method like this:

    $element = $val->validated("postarray.element");

    I just realized I was retrieving all the input via $val->input so the filters where not applied and it seems I cannot just simply change in all my code $val->input to $val->validated because it does not support retrieving array element? Is that true?
  • HarroHarro
    Accepted Answer
    At the moment validated() uses array_key_exists(), so no, you can not use dot-notation for array elements at the moment.

    I've changed it to an Arr::get() call:

    Can you verify this addresses your issue?
  • I can confirm, thank you.
  • Perfect, thanks.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion