Old input for array?

三世轮回 提交于 2020-01-12 15:02:52

问题


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:


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

value="{{ old('article_title.'.$language_code) }}"


来源:https://stackoverflow.com/questions/42050732/old-input-for-array

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!