vendredi 3 mars 2017

Trying to get property of non-object - laravel - elasticsearch

Trying to get property of non-object (View: C:\xampp\htdocs\elasticsearch\resources\views\presult.blade.php) (View: C:\xampp\htdocs\elasticsearch\resources\views\presult.blade.php)

Please help me .......

 $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;

In the view :

  @foreach($books as $Afica)

        <article class="one-third">
          <figure><a href="#" title=""><img src="}" alt="" style="height: 215px!important;" /></a></figure>

          <div class="details">

            <h3>}
              <span class="stars">

                  <?php 

                  for ($i=1 ; $i<=$Afica->class ; $i++) 
                  {
                  echo ' <i class="material-icons">&#xE838;</i>';
                  }

              ?>
              </span>
            </h3>
            <span class="address">},}  <a href="">Show on map</a></span>
            <span class="rating">}</span>
            <span class="price">Max rate  <em>$ }</em> </span>
            <span class="pricee">Min rate  <em>$ }</em> </span>
            <div class="description">
              <p>}<a href="hotel?query=}">More info</a></p>
            </div>   
            <a href="}" title="Book now" class="gradient-button">Book now</a>
          </div>
        </article><?php $myArray[] = $Afica->id;?>

        <!--//deal-->
        @endforeach



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire