如何使用php laravel调整列中的句子

时间:2018-02-14 02:18:51

标签: php mysql database laravel

嘿,所以目前我有一个数据库,列中有一个列调用sampleQ1,它的问题示例。因此,其中一个问题是:'我希望申请时需要哪些文件?'我想知道如何在一个页面中调用此问题,然后让用户调整?有办法吗?目前我还有另外一个功能,我只想知道如何交换价值?

目前如何调用句子如下:

控制器:



public function newTest($companyID, $entityType,$q)
	{
		$db = [];
		$dmb = DiraMasterBot::all();
		foreach ($dmb AS $datum) 
		{ 
			if (!isset($db[$datum->description])) $db[$datum->description] = ['intent' => [], 'q1' => [], 'q2' => [], 'q3' => []]; 
			$db[$datum->description]['intent'][$datum->intent] = $datum->id; 

			if (!isset($db[$datum->description])) $db[$datum->description] = ['intent' => [], 'q1' => [], 'q2' => [], 'q3' => []]; 
			$db[$datum->description]['q1'][$datum->sampleQ1] = $datum->id; 

			if (!isset($db[$datum->description])) $db[$datum->description] = ['intent' => [], 'q1' => [], 'q2' => [], 'q3' => []]; 
			$db[$datum->description]['q2'][$datum->sampleQ2] = $datum->id; 

			if (!isset($db[$datum->description])) $db[$datum->description] = ['intent' => [], 'q1' => [], 'q2' => [], 'q3' => []]; 
			$db[$datum->description]['q3'][$datum->sampleQ3] = $datum->id; 
		} 

		ksort($db);
		// dd($db);

		return view('AltHr.Chatbot.newTest', compact('db', 'dmb','entityType','companyID','q'));
	}




视图:



@foreach($questionAnswer['q2'] as $question => $questionID)
                      <table class="question">
                        <tr>
                          <td class="labels"><p>User:</p></td>
                          <td><p>&nbsp;{{$question}}</p></td>
                        </tr>
                      </table>
                      @endforeach
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

我找到了使用

的答案

&#13;
&#13;
mutate_at()
&#13;
&#13;
&#13;