如何在laravel的编辑页面中从db获取json值
嗨,伙计们,我有多个部分的表单,所以在插入时,我会存储我所选择的特定部分。所以我将这些值以json格式存储在db中。现在我只想在我的编辑页面中获取这些特定部分的值 以下是我存储所有json代码的函数:如何在laravel的编辑页面中从db获取json值,json,laravel,Json,Laravel,嗨,伙计们,我有多个部分的表单,所以在插入时,我会存储我所选择的特定部分。所以我将这些值以json格式存储在db中。现在我只想在我的编辑页面中获取这些特定部分的值 以下是我存储所有json代码的函数: function toggler(section_value, from_where) { var html_question_section = ''; var html_question_section_display = ''; var section
function toggler(section_value, from_where)
{
var html_question_section = '';
var html_question_section_display = '';
var section_counter = 0;
if(from_where == 'question')
{
question_section_counter += 1;
}
else if(from_where == 'solution')
{
soution_section_counter += 1;
}
if(section_value == 'text_section')
{
question_text_section_counter += 1;
section_counter = question_text_section_counter;
}
else if(section_value == 'image_section')
{
question_image_section_counter += 1;
section_counter = question_image_section_counter;
}
else if(section_value == 'sol_text_section')
{
soution_text_section_counter += 1;
section_counter = soution_text_section_counter;
}
else if(section_value == 'sol_text_chk_section')
{
soution_text_chk_section_counter += 1;
section_counter = soution_text_chk_section_counter;
}
else if(section_value == 'sol_image_chk_section')
{
soution_img_chk_section_counter += 1;
section_counter = soution_img_chk_section_counter;
}
else if(section_value == 'sol_text_radio_section')
{
soution_text_radio_section_counter += 1;
section_counter = soution_text_radio_section_counter;
}
else if(section_value == 'sol_image_radio_section')
{
soution_img_radio_section_counter += 1;
section_counter = soution_img_radio_section_counter;
}
html_question_section = getSectionHtml(section_value, section_counter, from_where);
html_question_section_display = getSectionDisplay(section_value, section_counter);
template_json = getTemplateJSON(section_value, from_where);
if(from_where == 'question')
{
$('#div_question_section').append(html_question_section);
$('#div_display_question_section').append(html_question_section_display);
}
else
{
$('#div_solution_section').append(html_question_section);
$('#div_display_solution_section').append(html_question_section_display);
}
var json_string = JSON.stringify(template_json, undefined, 2);
$('.json_template').html(json_string).val(json_string);
}
以下是我的控制器代码:
$template->template_json = json_encode($request->input('json_template'));
谁能帮助我如何在编辑页面中获取这些值。取决于我应该获取的索引