Search code examples
phplaravelhelper

use old helper in nestead inputs


I am using laravel and I have input like this

<input value="{{ old('group[1][p_id]') }}" type="text" class="form-control inputfield min-width-140" name="group[1][p_id]" placeholder=" 30">

but whenever I want to use old helper it does not work well

how can I use old helper in this case?


Solution

  • For a field with the name group[1][p_id] you use old('group.1.p_id').

    When p_id is a dynamic field and your input field name is like group[1][3] you can use old like old('group.1.' . $p_id).