尝试获取非对象的属性(查看:C:\ xampp \ htdocs \ elasticsearch \ resources \ views \ presult.blade.php)(查看:C:\ xampp \ htdocs \ elasticsearch \ resources \ views \ presult .blade.php)
请帮助我.......
$query = Input::get('query', false);
$brans = request()->priceFilter;
if(!empty($brans)):
$product = "";
foreach($brans as $data){
$minMax = explode("-",$data);
$client = ClientBuilder::create()->build();
$product[] = $client->search([
"index"=> "my_custom_aficaa",
"body"=>[
"query"=>[
"bool"=>[
"must"=>[
"query_string"=>[
"query"=> "casablanca"
] ],
"filter" => [
"bool"=>[
"should"=>[
["range"=> ["minrate"=>["gte"=> $minMax[0],"lte"=>$minMax[1]]]],
]
]
]
]
],
"from" => 0,
"size"=>10000
]
]);
}
$books = $product[0];
for($i=1;$i<count($product);$i++){
$books= $product[$i]
->paginate(25);
}
if ($request->ajax())
{
return view('presult', compact('books'));
}
return view("welcome")->with('books',$books);
else:
$books = Afica::search()
->paginate(26);
return view("welcome")->with('books',$books);
endif;
在视图中:
@foreach($books as $Afica)
<article class="one-third">
<figure><a href="#" title=""><img src="{{{ $Afica->photo_url }}}" alt="" style="height: 215px!important;" /></a></figure>
<div class="details">
<h3>{{{ $Afica->name }}}
<span class="stars">
<?php
for ($i=1 ; $i<=$Afica->class ; $i++)
{
echo ' <i class="material-icons"></i>';
}
?>
</span>
</h3>
<span class="address">{{{ $Afica->city_hotel }}},{{{ $Afica->address }}} <a href="">Show on map</a></span>
<span class="rating">{{{ $Afica->preferred }}}</span>
<span class="price">Max rate <em>$ {{{ $Afica->maxrate }}}</em> </span>
<span class="pricee">Min rate <em>$ {{{ $Afica->minrate }}}</em> </span>
<div class="description">
<p>{{{ $Afica->desc_en }}}<a href="hotel?query={{{ $Afica->name }}}">More info</a></p>
</div>
<a href="{{{ $Afica->hotel_url }}}" title="Book now" class="gradient-button">Book now</a>
</div>
</article><?php $myArray[] = $Afica->id;?>
<!--//deal-->
@endforeach