I fetching data from DB and when I do that, trying to eliminate null rows.
public function search(Request $request)
{
$q = $request->q;
$estates = \DB::table('allestates')
->whereNotNull('lat')
->whereNotNull('lng')
->where('lat', '!=', '')
->where('log', '!=', '')
->where(function($query) {
$query->where("building_name", "LIKE", "%" . $q . "%")
->orWhere("address", "LIKE", "%" . $q . "%")
->orWhere("company_name", "LIKE", "%" . $q . "%")
->orWhere("region", "LIKE", "%" . $q . "%")
})
->orderBy('price')->paginate(8);
return view("home", compact('estates', 'q'));
}
I can't figure out how to solve syntax error at this line:
})
->orderBy('price')->paginate(8);