Your like
query implementation is not correct.
Try this :
public function findTag()
{
$term = Input::get('tag_name');
return Tag::where('tag_name', 'LIKE', '%' .$term . '%')->lists('tag_name');
}
When I exactly what you have there it returns all of the results. When I only replace the query and leave the rest alone, it doesn't return anything.
Check this http://www.w3schools.com/sql/sql_like.asp how to use % in LIKE operator.
Maybe die/dump the query so you can see what the DB is actually getting... prior to your foreach() you could try:
$search = Tag::where('tag_name', 'LIKE', '%' . $term . '%')->get();
dd(DB::getQueryLog());
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community