我有一个表,该表显示基于从控制器获取的数据的值,是否有任何方法可以基于文本字段输入在表中显示值,即 不断变化
<form method="get" action="{{URL::to('/reservations')}}">
<div class="form-row">
<div class="form-group col-md-12 col-lg-6">
<label for="guest">Guest name</label>
<div class="search">
<span class="fa fa-search"></span>
<input type="text" placeholder="Guest name" name="guest" class="form-control" id="search">
</div>
</div>
<div class="col-md-2 col-lg-6" >
<input id="search-btn" class="btn btn-primary" type="submit" value="Search">
</div>
</div>
</form>
我的代码:
public function refreshPastReservations(){
$ts = strtotime('today');
$today= date('Y-m-d', $ts);
$defaultPropertyId = (session()->get('default_property'))->id;
$property_id = $defaultPropertyId ;
$pasts=Reservation::where('booking_status','BOOKED')
->where('property_id', $property_id)->where('check_out', '>', $today)
->orderBy('check_in', 'asc')->get()->paginate(10);
return view('home.partials.past-partial',compact('pasts') );
}
@foreach($pasts as $past)
<tr class="bg-white div-hover text-center room-reserve" id="reserved" data-id="{{$past->id}}" style="cursor: pointer;">
<td>{{$past->guest['first_name']}} {{$past->guest['last_name']}}</td>
<td><img src="/{{$past->channel['icon']}}" alt="" style="margin:0;padding:0; width:50px;height:50px; border-radius:50%;"></td>
{{-- <td>{{$reservation->property['name']}}</td> --}}
<td>@if(isset($past->reservationDetails[0]->number_of_rooms))@if($past->reservationDetails[0]->number_of_rooms >1)
{{$past->reservationDetails[0]->number_of_rooms}} {{$past->reservationDetails[0]->room_category[0]->description}}s
@else {{$past->reservationDetails[0]->room_category[0]->description}} @endif @endif
</td>
<td>{{$past->number_of_guests}}</td>
<td>{{$past->channel['name']}}</td>
<td>{{date('d/m/Y',(strtotime($past->check_in)))}} to {{date('d/m/Y',(strtotime($past->check_out)))}}</td>
@endforeach