public function retrieveSearch($id, Search $search) { $result = $search->getSearch($id); if ($result instanceof Illuminate\Database\Eloquent\ModelNotFoundException) { return view('compare-form')->with('message', 'Could not find that listing. It may have been deleted'); } else { $leeds = json_decode($result->leeds); $london = json_decode($result->london); $searchresult = $result->id; $result->sale_or_rent == 'rent' ? $rent = true : ($rent = false); return view('compare-results', compact('leeds', 'london', 'searchresult', 'rent')); } }