Old input for array?

2020-07-03 06:38发布

I have foreach and inside foreach i have input like this:

 <input type="text" id="text-title" name="article_title[{{$language->code}}]" value="{{ old('article_title[$language->code]') }}" class="form_input"  />

Im trying to add old input like this but its not working. Any suggestion how can i use old for array?

Also i tried this but also not working:

  <input type="text" id="text-title" name="article_title[{{$language->code}}]" value="{{ old('article_title.0') }}" class="form_input"  />

I have validation only for first iteration if that means anything for you.

1条回答
ゆ 、 Hurt°
2楼-- · 2020-07-03 07:10

You should be able to access the index off of your language code:

value="{{ old('article_title.'.$language_code) }}"
查看更多
登录 后发表回答