0
它只是我或它是我的foreach循環表現怪異。我已經做了一個foreach來檢查是否有結果被提取,但如果沒有,我會顯示一條通知/文本確認現在有結果。這裏的問題是,如果它不返回任何內容,我將不會顯示任何文本。這裏似乎是什麼問題?Foreach Laravel 4
@extends('layouts.master')
@section('content')
{{ Form::open(['url'=>'flight/onewayflightresults']) }}
<div>
<p>Scheduled Flights</p>
</div>
<table class="table table-hover">
<th>Reserve</th>
<th>#</th>
<th>From</th>
<th>To</th>
<th>Departure</th>
<th>Adult</th>
<th>Children</th>
<th>Fare per person</th>
<th>Book Flight</th>
@foreach($result as $row)
@if(count($row) != 0)
<tr>
<td>{{Form::checkbox('reserve', 'value');}}</td>
<td>{{$row -> id}}</td>
<td>{{$row -> destinationfrom}}</td>
<td>{{$row -> destinationto}}</td>
<td>{{$row -> departure}}</td>
<td>{{{$adult}}}</td>
<td>{{{$child}}}</td>
<td>₱{{{$row -> fare}}}</td>
<td>{{ Form::submit(' ✔ ',array('class'=>'btn btn-success')) }}</td>
</tr>
@else
<p class="bg-danger">Sorry but we have no available flight schedule on your desidered date.</p>
@endif
@endforeach
</table>
{{ Form::close() }}
@endsection
感謝您的時間和答覆。這工作像魔術一樣。 – staphhelpme 2014-10-04 16:00:47