Support the ongoing development of →
Input Database Forms
Last updated 1 year ago.

I think you're looking for the faceted search ? do a google search for "laravel facet search" and there are many tutorials.


I think this will solve it:

{{{ $result['name'] }}}

on /vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php

 * Execute the query as a "select" statement.
 * @param  array  $columns
 * @return array|static[]
public function get($columns = array('*'))
	return $this->getFresh($columns);

As written there, this function returns array.

Last updated 8 years ago.

In your view you are looking for a variable called $results which is not set. When you are creating your view you are only passing through one variable called $products in your code: return view('search')->with('products', $results);

Either change your return to be return view('search')->with('results', $results); or update your view to use $products rather than $results.

Let me know if you need more help :-)

Last updated 8 years ago.

Hey thanks for replying :) . I changed it but i cant get the results. The view says either Undefined index: name or if I have it like $product->name it says call to non object. Any ideas?

Last updated 8 years ago.

I would be interested in seeing a var_dump of $results because from what I can see it should be working unless I have forgotten some idiosyncrasy of how Laravels query builder returns results.


Does your view (blade template) now look like this maneesaj?

   if(isset($products)){ ?>
  @foreach($products as $product)
   {{{ $product->name }}}
  <?php } else {
  echo "products not set";

(I've kept similar to your original code, simply substituting $results and $result for $products and $product. You could clean a little more using blade syntax for the if/else statements.)


Hey Thanks for the replies. I managed to fix it, it was an issue with the database migrations. Thanks for your help :).


Match your controller and view files with the one given here: This is a working tutorial on create live search in Laravel 5.5. Basic things should be the same. This could work for you as well. Try out.


Sign in to participate in this thread!


Your banner here too?

maneesaj maneesaj Joined 28 Feb 2015


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.