public function getSchools(Request $request) { $filter = $request->input('filter'); Log::info($filter); if (!$filter) { $filter = ""; } $locs = School::where("name", "like", "%" . $filter . "%")->get(); return $locs; }
/** * Show the peace school screen to the user. * * @return Response */ public function school($location = null) { //Decide whether details or school list page to open if ($location == null) { $school = School::orderBy('id')->get(); return view('publicViewables.school')->with('schools', $school); } //Convert slugged text to normal spaced text if (str_contains($location, '-')) { $location = str_replace('-', ' ', $location); } $school = School::where('location', '=', $location)->first() or abort('404'); return view('publicViewables.viewSchool')->with('school', $school); }