@@ -17,12 +17,12 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | public function index() |
| 19 | 19 | { |
| 20 | - $hospital = Hospital::orderBy('city_id','asc')->paginate(10); |
|
| 20 | + $hospital = Hospital::orderBy('city_id', 'asc')->paginate(10); |
|
| 21 | 21 | $data = [ |
| 22 | 22 | 'role' => session('role'), |
| 23 | 23 | 'hospital' => $hospital |
| 24 | 24 | ]; |
| 25 | - return view('pages.hospital')->with('data',$data); |
|
| 25 | + return view('pages.hospital')->with('data', $data); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | /** |
@@ -63,11 +63,11 @@ discard block |
||
| 63 | 63 | $hospital->public_services = $request->input('public_services'); |
| 64 | 64 | $hospital->cover_images_id = 1; |
| 65 | 65 | |
| 66 | - if($hospital->save()) { |
|
| 67 | - return redirect (route('hospital.index'))->with('success', 'Rumah sakit berhasil di tambahkan !'); |
|
| 66 | + if ($hospital->save()) { |
|
| 67 | + return redirect(route('hospital.index'))->with('success', 'Rumah sakit berhasil di tambahkan !'); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - return redirect (route('hospital.index'))->with('failed', 'Gagal menambahkan rumah sakit !'); |
|
| 70 | + return redirect(route('hospital.index'))->with('failed', 'Gagal menambahkan rumah sakit !'); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | public function show($id) |
| 80 | 80 | { |
| 81 | 81 | $hospital = Hospital::find($id); |
| 82 | - if(!$hospital) { |
|
| 82 | + if (!$hospital) { |
|
| 83 | 83 | abort(401); |
| 84 | 84 | } |
| 85 | 85 | $data = [ |
@@ -136,11 +136,11 @@ discard block |
||
| 136 | 136 | $hospital->public_services = $request->input('public_services'); |
| 137 | 137 | $hospital->cover_images_id = 1; |
| 138 | 138 | |
| 139 | - if($hospital->save()) { |
|
| 140 | - return redirect (route('hospital.index'))->with('success', 'Rumah sakit berhasil di perbaharui'); |
|
| 139 | + if ($hospital->save()) { |
|
| 140 | + return redirect(route('hospital.index'))->with('success', 'Rumah sakit berhasil di perbaharui'); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - return redirect (route('hospital.edit', $id))->with('failed', 'Gagal memperbaharui rumah sakit !'); |
|
| 143 | + return redirect(route('hospital.edit', $id))->with('failed', 'Gagal memperbaharui rumah sakit !'); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | /** |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | $hospital = Hospital::find($id); |
| 155 | 155 | $rooms = $this->deleteRoomsAndRoomDetail($id); |
| 156 | 156 | |
| 157 | - if($hospital->delete() && $rooms) { |
|
| 157 | + if ($hospital->delete() && $rooms) { |
|
| 158 | 158 | return redirect(route('hospital.index')); |
| 159 | 159 | } |
| 160 | 160 | |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | ->where('hospital_id', '=', $hospital_id) |
| 175 | 175 | ->delete(); |
| 176 | 176 | |
| 177 | - if($delroom && $deldetail) { |
|
| 177 | + if ($delroom && $deldetail) { |
|
| 178 | 178 | return true; |
| 179 | 179 | } |
| 180 | 180 | |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | $rooms = DB::table('rooms') |
| 191 | 191 | ->selectRaw(DB::raw('rooms.*')) |
| 192 | 192 | ->leftJoin('room_details', 'rooms.id', '=', 'room_details.room_id') |
| 193 | - ->where('room_details.hospital_id','=',$hospital_id) |
|
| 193 | + ->where('room_details.hospital_id', '=', $hospital_id) |
|
| 194 | 194 | ->get(); |
| 195 | 195 | |
| 196 | 196 | return $rooms; |
@@ -198,13 +198,13 @@ discard block |
||
| 198 | 198 | |
| 199 | 199 | public function indexUser() |
| 200 | 200 | { |
| 201 | - $location = City::orderBy('name','asc')->pluck('name', 'id'); |
|
| 201 | + $location = City::orderBy('name', 'asc')->pluck('name', 'id'); |
|
| 202 | 202 | $img = 'storage/images/hospital-icon.jpg'; |
| 203 | 203 | $data = [ |
| 204 | 204 | 'img' => $img, |
| 205 | 205 | 'location' => $location |
| 206 | 206 | ]; |
| 207 | - return view ('SearchRS')->with('data',$data); |
|
| 207 | + return view('SearchRS')->with('data', $data); |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | public function showList() |
@@ -214,30 +214,30 @@ discard block |
||
| 214 | 214 | |
| 215 | 215 | public function searchHospital(Request $request) |
| 216 | 216 | { |
| 217 | - if($request->nama == null AND $request->location != null){ |
|
| 218 | - $hospital = Hospital::where('city_id',$request->location)->orderBy('name','asc')->paginate(5); |
|
| 219 | - }elseif ($request->location == null AND $request->nama != null){ |
|
| 220 | - $hospital = Hospital::where('biography','LIKE','%'.$request->nama.'%')->orderBy('name','asc')->paginate(5); |
|
| 221 | - }else{ |
|
| 222 | - $hospital = Hospital::where('biography','LIKE','%'.$request->nama.'%')->where('city_id',$request->location)->orderBy('name','asc')->paginate(5); |
|
| 217 | + if ($request->nama == null AND $request->location != null) { |
|
| 218 | + $hospital = Hospital::where('city_id', $request->location)->orderBy('name', 'asc')->paginate(5); |
|
| 219 | + }elseif ($request->location == null AND $request->nama != null) { |
|
| 220 | + $hospital = Hospital::where('biography', 'LIKE', '%'.$request->nama.'%')->orderBy('name', 'asc')->paginate(5); |
|
| 221 | + } else { |
|
| 222 | + $hospital = Hospital::where('biography', 'LIKE', '%'.$request->nama.'%')->where('city_id', $request->location)->orderBy('name', 'asc')->paginate(5); |
|
| 223 | 223 | } |
| 224 | - $location = City::orderBy('name','asc')->pluck('name','id'); |
|
| 224 | + $location = City::orderBy('name', 'asc')->pluck('name', 'id'); |
|
| 225 | 225 | $data = [ |
| 226 | 226 | 'hospital' => $hospital, |
| 227 | 227 | 'location' => $location |
| 228 | 228 | ]; |
| 229 | - return view ('listHospital')->with('data',$data); |
|
| 229 | + return view('listHospital')->with('data', $data); |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | public function searchContent($content) |
| 233 | 233 | { |
| 234 | - $hospital = Hospital::where('biography','LIKE','%'.$content.'%')->orderBy('name','asc')->paginate(5); |
|
| 235 | - $location = City::orderBy('name','asc')->pluck('name','id'); |
|
| 234 | + $hospital = Hospital::where('biography', 'LIKE', '%'.$content.'%')->orderBy('name', 'asc')->paginate(5); |
|
| 235 | + $location = City::orderBy('name', 'asc')->pluck('name', 'id'); |
|
| 236 | 236 | $data = [ |
| 237 | 237 | 'hospital' => $hospital, |
| 238 | 238 | 'location' => $location |
| 239 | 239 | ]; |
| 240 | - return view ('listHospital')->with('data',$data); |
|
| 240 | + return view('listHospital')->with('data', $data); |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | public function viewHospital($id) |
@@ -247,6 +247,6 @@ discard block |
||
| 247 | 247 | 'hospital' => $hospital, |
| 248 | 248 | 'room' => $this->getRooms($id), |
| 249 | 249 | ]; |
| 250 | - return view ('viewhospital')->with('data',$data); |
|
| 250 | + return view('viewhospital')->with('data', $data); |
|
| 251 | 251 | } |
| 252 | 252 | } |
@@ -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'); |
@@ -214,9 +214,9 @@ |
||
| 214 | 214 | |
| 215 | 215 | public function searchHospital(Request $request) |
| 216 | 216 | { |
| 217 | - if($request->nama == null AND $request->location != null){ |
|
| 217 | + if($request->nama == null and $request->location != null){ |
|
| 218 | 218 | $hospital = Hospital::where('city_id',$request->location)->orderBy('name','asc')->paginate(5); |
| 219 | - }elseif ($request->location == null AND $request->nama != null){ |
|
| 219 | + }elseif ($request->location == null and $request->nama != null){ |
|
| 220 | 220 | $hospital = Hospital::where('biography','LIKE','%'.$request->nama.'%')->orderBy('name','asc')->paginate(5); |
| 221 | 221 | }else{ |
| 222 | 222 | $hospital = Hospital::where('biography','LIKE','%'.$request->nama.'%')->where('city_id',$request->location)->orderBy('name','asc')->paginate(5); |