@@ -8,8 +8,7 @@ discard block |
||
| 8 | 8 | use App\Hospital; |
| 9 | 9 | use App\City; |
| 10 | 10 | |
| 11 | -class HospitalController extends Controller |
|
| 12 | -{ |
|
| 11 | +class HospitalController extends Controller { |
|
| 13 | 12 | /** |
| 14 | 13 | * Display a listing of the resource. |
| 15 | 14 | * |
@@ -214,11 +213,11 @@ discard block |
||
| 214 | 213 | |
| 215 | 214 | public function searchHospital(Request $request) |
| 216 | 215 | { |
| 217 | - if($request->nama == null AND $request->location != null){ |
|
| 216 | + if($request->nama == null AND $request->location != null) { |
|
| 218 | 217 | $hospital = Hospital::where('city_id',$request->location)->orderBy('name','asc')->paginate(5); |
| 219 | - }elseif ($request->location == null AND $request->nama != null){ |
|
| 218 | + } elseif ($request->location == null AND $request->nama != null) { |
|
| 220 | 219 | $hospital = Hospital::where('biography','LIKE','%'.$request->nama.'%')->orderBy('name','asc')->paginate(5); |
| 221 | - }else{ |
|
| 220 | + } else { |
|
| 222 | 221 | $hospital = Hospital::where('biography','LIKE','%'.$request->nama.'%')->where('city_id',$request->location)->orderBy('name','asc')->paginate(5); |
| 223 | 222 | } |
| 224 | 223 | $location = City::orderBy('name','asc')->pluck('name','id'); |