public function retrieve() { $pc = Request::get('postcode'); $icity = Postcode::where("Postcode", "=", "{$pc}")->first(); $itemsair = Rating::where("Postcode", "=", "{$pc}")->where("Type", "=", "Air")->get(); $itemsnoise = Rating::where("Postcode", "=", "{$pc}")->where("Type", "=", "Noise")->get(); $itemsland = Rating::where("Postcode", "=", "{$pc}")->where("Type", "=", "Land")->get(); return view('display', compact('itemsair', 'itemsnoise', 'itemsland', 'icity')); }
/** * Search for a the postcode instance of the postcode. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function getSearchPostcode(Request $request) { $postcode = Postcode::where('postcode', '=', strtoupper($request->postcode))->first(); if (!$postcode) { $postcode = new Postcode(); $postcode->road = ''; $postcode->town = ''; } return $postcode; }