【发布时间】:2018-01-19 18:22:24
【问题描述】:
我想发布一个数组和一个变量来查看。这是我的变量。
$ausgabeSpieltag = $saisonMaxSpieltagEins;
这是我的数组以及我现在发布它以查看的方式。但现在我需要在 ->with 部分添加变量。
$spieltagSpiel = Spielplan::where('Spieltag', '=', $ausgabeSpieltag)->where('Abgeschlossen', '=', 0)->get();
foreach($spieltagSpiel as $spieltagSpielOutput){
$heimName = Verein::where('V_ID', '=', $spieltagSpielOutput->Heimmannschaft)->first();
$gastName = Verein::where('V_ID', '=', $spieltagSpielOutput->Gastmannschaft)->first();
$resultData[$spieltagSpielOutput->Spielplan_ID] = $heimName->Name. ' - ' .$gastName->Name;
}
return view('spielplan')->with('alleSpiele', $resultData);
这是我的输出刀片
<h3>Dateneingabe</h3>
{{$ausgabeSpieltag}}
<div class="row">
<div class="col-6 col-md-4">
<label for="">Spielauswahl</label>
<select class="form-control input-sm" name="spiele" id="spiele">
@foreach( $alleSpiele as $alleSpieleKey => $alleSpieleName )
<option value="{{ $alleSpieleKey }}">
{{ $alleSpieleName }}
</option>
@endforeach
</select>
</div>
<div class="col-6 col-md-4">
<label for="">Teamauswahl</label>
<select class="form-control input-sm" name="spiel" id="spiel">
</select>
</div>
<div class="col-6 col-md-4">
Hier kommt der Abgeschlossen Button hin
</div>
</div>
除了我的 {{$ausgabeVariable}},一切正常。在变量中只有 1 个数字,我想在 Dateneingabe 之后在我的 H3 中有这个。
【问题讨论】:
标签: php arrays laravel view blade