1 回答

TA貢獻(xiàn)1820條經(jīng)驗(yàn) 獲得超10個(gè)贊
你不應(yīng)該在控制器中構(gòu)建你的 html。由于這是您第一次使用刀片,我將在下面提供一個(gè)簡(jiǎn)單的示例。
首先,將數(shù)據(jù)從控制器傳遞到視圖。
$results = ...(your query)...
return view('your-view', compact('results'));
然后使用刀片指令(例如,@foreach)在視圖中構(gòu)建您的結(jié)果。
@extends('layouts.mainlayout')
@section('content')
<div class="container" style="height 55rem;">
<div class="row">
<div class="col" id="locations_results" style="overflow-y: auto; width: 40%; height: 55rem;">
<!--Here is where I want the results to go-->
@foreach ($results as $result)
<!-- Use double curly braces for showing variable data -->
{{ $result->id }}
@endforeach
</div>
<div class="col" style="">
@include('layouts.map')
</div>
</div>
- 1 回答
- 0 關(guān)注
- 176 瀏覽
添加回答
舉報(bào)