@@ -35,7 +35,7 @@ |
||
| 35 | 35 | */ |
| 36 | 36 | public function trimStr($str) |
| 37 | 37 | { |
| 38 | - if(strlen($str) > 15) { |
|
| 38 | + if (strlen($str) > 15) { |
|
| 39 | 39 | return substr($str, 0, 15)."..."; |
| 40 | 40 | } |
| 41 | 41 | return $str; |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public function city() |
| 36 | 36 | { |
| 37 | - return $this->belongsTo('App\City','city_id'); |
|
| 37 | + return $this->belongsTo('App\City', 'city_id'); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public function trimStr($str) |
| 45 | 45 | { |
| 46 | - if(strlen($str) > 10) { |
|
| 46 | + if (strlen($str) > 10) { |
|
| 47 | 47 | return substr($str, 0, 10)."..."; |
| 48 | 48 | } |
| 49 | 49 | return $str; |
@@ -41,12 +41,12 @@ discard block |
||
| 41 | 41 | 'warning' => null |
| 42 | 42 | ]; |
| 43 | 43 | |
| 44 | - if( $doctor->city_id == null || |
|
| 44 | + if ($doctor->city_id == null || |
|
| 45 | 45 | $doctor->gender == null || |
| 46 | 46 | $doctor->biography == null || |
| 47 | 47 | $doctor->profile_picture == 'user-default.jpg') { |
| 48 | 48 | |
| 49 | - $data['warning'] = 'Sepertinya anda belum melengkapi data diri anda, segera lengkapi data diri anda.'; |
|
| 49 | + $data[ 'warning' ] = 'Sepertinya anda belum melengkapi data diri anda, segera lengkapi data diri anda.'; |
|
| 50 | 50 | } |
| 51 | 51 | return view('pages.dashboard')->with('data', $data); |
| 52 | 52 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | public function profile($id) |
| 61 | 61 | { |
| 62 | 62 | $doctor = $this->currentUser(); |
| 63 | - if($doctor->id == $id) { |
|
| 63 | + if ($doctor->id == $id) { |
|
| 64 | 64 | $data = [ |
| 65 | 65 | 'doctor' => $doctor |
| 66 | 66 | ]; |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | public function edit($id) |
| 80 | 80 | { |
| 81 | 81 | $doctor = $this->currentUser(); |
| 82 | - if($doctor->id == $id) { |
|
| 82 | + if ($doctor->id == $id) { |
|
| 83 | 83 | $specialization = DoctorSpecialization::pluck('name', 'id'); |
| 84 | 84 | $cities = City::pluck('name', 'id'); |
| 85 | 85 | |
@@ -115,9 +115,9 @@ discard block |
||
| 115 | 115 | $doctor = $this->currentUser(); |
| 116 | 116 | $img = null; |
| 117 | 117 | |
| 118 | - if($request->hasFile('profile_picture')) { |
|
| 118 | + if ($request->hasFile('profile_picture')) { |
|
| 119 | 119 | |
| 120 | - if( $doctor->profile_picture != "user-default.jpg") { |
|
| 120 | + if ($doctor->profile_picture != "user-default.jpg") { |
|
| 121 | 121 | Storage::delete('public/user_images/'.$doctor->profile_picture); |
| 122 | 122 | } |
| 123 | 123 | |
@@ -139,11 +139,11 @@ discard block |
||
| 139 | 139 | $doctor->gender = $request->input('gender'); |
| 140 | 140 | $doctor->specialization_id = $request->input('specialization_id'); |
| 141 | 141 | $doctor->biography = $request->input('biography'); |
| 142 | - if($request->hasFile('profile_picture')) { |
|
| 142 | + if ($request->hasFile('profile_picture')) { |
|
| 143 | 143 | $doctor->profile_picture = $img; |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - if($doctor->save()) { |
|
| 146 | + if ($doctor->save()) { |
|
| 147 | 147 | return redirect(route('doctor.profile', $doctor->id))->with('success', 'Profil berhasil diperbarui !'); |
| 148 | 148 | } |
| 149 | 149 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | public function editPass($id) |
| 160 | 160 | { |
| 161 | 161 | $doctor = $this->currentUser(); |
| 162 | - if($doctor->id == $id) { |
|
| 162 | + if ($doctor->id == $id) { |
|
| 163 | 163 | $data = [ |
| 164 | 164 | 'doctor' => $doctor |
| 165 | 165 | ]; |
@@ -178,8 +178,8 @@ discard block |
||
| 178 | 178 | public function updatePass(Request $request, $id) |
| 179 | 179 | { |
| 180 | 180 | $doctor = $this->currentUser(); |
| 181 | - if($this->validatePass($request->input('old_password'))) { |
|
| 182 | - if($request->input('old_password') == $request->input('new_password')) { |
|
| 181 | + if ($this->validatePass($request->input('old_password'))) { |
|
| 182 | + if ($request->input('old_password') == $request->input('new_password')) { |
|
| 183 | 183 | return redirect(route('doctor.password.edit', $doctor->id))->with('warning', 'Password baru tidak boleh sama dengan Password lama.'); |
| 184 | 184 | } |
| 185 | 185 | |
@@ -203,12 +203,12 @@ discard block |
||
| 203 | 203 | public function removeImage() |
| 204 | 204 | { |
| 205 | 205 | $doctor = $this->currentUser(); |
| 206 | - if($doctor->profile_picture != "user-default.jpg") { |
|
| 206 | + if ($doctor->profile_picture != "user-default.jpg") { |
|
| 207 | 207 | Storage::delete('public/user_images/'.$doctor->profile_picture); |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | $doctor->profile_picture = "user-default.jpg"; |
| 211 | - if($doctor->save()) { |
|
| 211 | + if ($doctor->save()) { |
|
| 212 | 212 | return redirect(route('doctor.profile.edit', $doctor->id))->with('success', 'Foto profil berhasil dihapus !'); |
| 213 | 213 | } |
| 214 | 214 | return redirect(route('doctor.profile.edit', $doctor->id))->with('failed', 'Gagal menghapus foto profil.'); |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | public function destroy() |
| 219 | 219 | { |
| 220 | 220 | $doctor = $this->currentUser(); |
| 221 | - if($doctor->delete()) { |
|
| 221 | + if ($doctor->delete()) { |
|
| 222 | 222 | session()->flush(); |
| 223 | 223 | return redirect(route('doctor.login'))->with('success', 'Akun telah dihapus !'); |
| 224 | 224 | } |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | private function validatePass(string $oldPassword) |
| 243 | 243 | { |
| 244 | 244 | $doctor = $this->currentUser(); |
| 245 | - if(Hash::check($oldPassword, $doctor->password)) { |
|
| 245 | + if (Hash::check($oldPassword, $doctor->password)) { |
|
| 246 | 246 | return true; |
| 247 | 247 | } |
| 248 | 248 | |
@@ -52,11 +52,11 @@ discard block |
||
| 52 | 52 | $specialty->name = $request->input('name'); |
| 53 | 53 | $specialty->detail = $request->input('detail'); |
| 54 | 54 | |
| 55 | - if($specialty->save()) { |
|
| 56 | - return redirect (route('specialty.index'))->with('success', 'Spesialisasi telah di tambahkan'); |
|
| 55 | + if ($specialty->save()) { |
|
| 56 | + return redirect(route('specialty.index'))->with('success', 'Spesialisasi telah di tambahkan'); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - return redirect (route('specialty.index'))->with('failed', 'Gagal menambah spesialisasi !'); |
|
| 59 | + return redirect(route('specialty.index'))->with('failed', 'Gagal menambah spesialisasi !'); |
|
| 60 | 60 | |
| 61 | 61 | } |
| 62 | 62 | |
@@ -104,11 +104,11 @@ discard block |
||
| 104 | 104 | $specialty->name = $request->input('name'); |
| 105 | 105 | $specialty->detail = $request->input('detail'); |
| 106 | 106 | |
| 107 | - if($specialty->save()) { |
|
| 108 | - return redirect (route('specialty.index'))->with('success', 'Spesialisasi telah di update'); |
|
| 107 | + if ($specialty->save()) { |
|
| 108 | + return redirect(route('specialty.index'))->with('success', 'Spesialisasi telah di update'); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - return redirect (route('specialty.edit', $id))->with('failed', 'Gagal memperbaharui spesialisasi !'); |
|
| 111 | + return redirect(route('specialty.edit', $id))->with('failed', 'Gagal memperbaharui spesialisasi !'); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | public function destroy($id) |
| 121 | 121 | { |
| 122 | 122 | $specialty = DoctorSpecialization::find($id); |
| 123 | - if($specialty->delete()) { |
|
| 123 | + if ($specialty->delete()) { |
|
| 124 | 124 | return redirect(route('specialty.index')); |
| 125 | 125 | } |
| 126 | 126 | } |
@@ -137,8 +137,8 @@ discard block |
||
| 137 | 137 | |
| 138 | 138 | public function indexSearch() |
| 139 | 139 | { |
| 140 | - $specialization = DoctorSpecialization::orderBy('created_at','desc')->orderBy('name', 'asc')->take(6)->get(); |
|
| 141 | - $location = City::orderBy('name','asc')->pluck('name','id'); |
|
| 140 | + $specialization = DoctorSpecialization::orderBy('created_at', 'desc')->orderBy('name', 'asc')->take(6)->get(); |
|
| 141 | + $location = City::orderBy('name', 'asc')->pluck('name', 'id'); |
|
| 142 | 142 | $data = [ |
| 143 | 143 | 'specialization' => $specialization, |
| 144 | 144 | 'location' => $location |
@@ -149,11 +149,11 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | public function searchSpecialty(Request $request) |
| 151 | 151 | { |
| 152 | - $specialization = DoctorSpecialization::where('name','LIKE','%'.$request->specialty.'%')->orderBy('name','asc')->get(); |
|
| 152 | + $specialization = DoctorSpecialization::where('name', 'LIKE', '%'.$request->specialty.'%')->orderBy('name', 'asc')->get(); |
|
| 153 | 153 | $data = [ |
| 154 | 154 | 'specialization' => $specialization |
| 155 | 155 | ]; |
| 156 | 156 | |
| 157 | - return view('LSdoctor')->with('data',$data); |
|
| 157 | + return view('LSdoctor')->with('data', $data); |
|
| 158 | 158 | } |
| 159 | 159 | } |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | public function trimStr(string $string) { |
| 25 | - if(strlen($string) > 200) { |
|
| 25 | + if (strlen($string) > 200) { |
|
| 26 | 26 | return substr($string, 0, 200).'...'; |
| 27 | 27 | } |
| 28 | 28 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | $user = null; |
| 33 | 33 | $err = null; |
| 34 | 34 | |
| 35 | - if($provider == 'google') { |
|
| 35 | + if ($provider == 'google') { |
|
| 36 | 36 | $user = Socialite::driver($provider)->stateless()->user(); |
| 37 | 37 | } else { |
| 38 | 38 | $user = Socialite::driver($provider)->user(); |
@@ -40,13 +40,13 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | $authUser = $this->findOrCreateUser($user, $provider); |
| 42 | 42 | |
| 43 | - $attempt = Auth::guard('web')->attempt(['email' => $authUser->email, 'password' => $authUser->provider_id]); |
|
| 43 | + $attempt = Auth::guard('web')->attempt([ 'email' => $authUser->email, 'password' => $authUser->provider_id ]); |
|
| 44 | 44 | |
| 45 | 45 | $req = new Request([ |
| 46 | 46 | 'email' => $authUser->email, |
| 47 | 47 | ]); |
| 48 | 48 | |
| 49 | - if($attempt) { |
|
| 49 | + if ($attempt) { |
|
| 50 | 50 | $msg = "Selamat Datang ".$authUser->name." !"; |
| 51 | 51 | return redirect()->intended(route('home'))->with('info', $msg); |
| 52 | 52 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | private function findOrCreateUser($user, $provider) |
| 66 | 66 | { |
| 67 | 67 | $authUser = User::where('email', $user->getEmail())->first(); |
| 68 | - if($authUser) { |
|
| 68 | + if ($authUser) { |
|
| 69 | 69 | return $authUser; |
| 70 | 70 | } |
| 71 | 71 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | private function sendFailedLoginResponse(Request $request) |
| 85 | 85 | { |
| 86 | 86 | throw ValidationException::withMessages([ |
| 87 | - 'email' => [trans('auth.failed')], |
|
| 87 | + 'email' => [ trans('auth.failed') ], |
|
| 88 | 88 | ]); |
| 89 | 89 | |
| 90 | 90 | } |
@@ -20,10 +20,10 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | public function __construct() |
| 22 | 22 | { |
| 23 | - $this->middleware('auth', ['except' => [ |
|
| 23 | + $this->middleware('auth', [ 'except' => [ |
|
| 24 | 24 | 'index', |
| 25 | 25 | 'showArticle' |
| 26 | - ]]); |
|
| 26 | + ] ]); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public function index() |
| 34 | 34 | { |
| 35 | - $article = Articles::where('category','penyakit')->orderBy('created_at','desc')->take(3)->get(); |
|
| 35 | + $article = Articles::where('category', 'penyakit')->orderBy('created_at', 'desc')->take(3)->get(); |
|
| 36 | 36 | return view('home')->with('article', $article); |
| 37 | 37 | } |
| 38 | 38 | |
@@ -46,11 +46,11 @@ discard block |
||
| 46 | 46 | public function profile($query) |
| 47 | 47 | { |
| 48 | 48 | $threads = null; |
| 49 | - if($query == "all") { |
|
| 49 | + if ($query == "all") { |
|
| 50 | 50 | $threads = Thread::where('user_id', $this->currentUser()->id) |
| 51 | 51 | ->orderBy('updated_at', 'desc') |
| 52 | 52 | ->paginate(3); |
| 53 | - } elseif($query == "answered") { |
|
| 53 | + } elseif ($query == "answered") { |
|
| 54 | 54 | $threads = Thread::where('user_id', $this->currentUser()->id) |
| 55 | 55 | ->where('status', true) |
| 56 | 56 | ->orderBy('updated_at', 'desc') |
@@ -73,11 +73,11 @@ discard block |
||
| 73 | 73 | public function edit($id) |
| 74 | 74 | { |
| 75 | 75 | $user = $this->currentUser(); |
| 76 | - if($user->id == $id) { |
|
| 76 | + if ($user->id == $id) { |
|
| 77 | 77 | $data = [ |
| 78 | 78 | 'user' => $user |
| 79 | 79 | ]; |
| 80 | - return view ('profile-edit')->with('data', $data); |
|
| 80 | + return view('profile-edit')->with('data', $data); |
|
| 81 | 81 | } |
| 82 | 82 | return redirect()->back()->with('warning', 'Anda tidak berhak untuk mengakses laman tersebut.'); |
| 83 | 83 | } |
@@ -90,11 +90,11 @@ discard block |
||
| 90 | 90 | public function editPass($id) |
| 91 | 91 | { |
| 92 | 92 | $user = $this->currentUser(); |
| 93 | - if($user->id == $id) { |
|
| 93 | + if ($user->id == $id) { |
|
| 94 | 94 | $data = [ |
| 95 | 95 | 'user' => $user |
| 96 | 96 | ]; |
| 97 | - return view ('profile-password')->with('data', $data); |
|
| 97 | + return view('profile-password')->with('data', $data); |
|
| 98 | 98 | } |
| 99 | 99 | return redirect()->back()->with('warning', 'Anda tidak berhak untuk mengakses laman tersebut.'); |
| 100 | 100 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | public function update(Request $request, $id) |
| 110 | 110 | { |
| 111 | - $this->validate($request,[ |
|
| 111 | + $this->validate($request, [ |
|
| 112 | 112 | 'name' => 'required|min:3', |
| 113 | 113 | 'email' => 'required|email', |
| 114 | 114 | 'image' => 'image|nullable|max:3999' |
@@ -117,9 +117,9 @@ discard block |
||
| 117 | 117 | $img = null; |
| 118 | 118 | $user = $this->currentUser(); |
| 119 | 119 | |
| 120 | - if($request->hasFile('image')) { |
|
| 120 | + if ($request->hasFile('image')) { |
|
| 121 | 121 | |
| 122 | - if( $user->profile_picture != "user-default.jpg" && |
|
| 122 | + if ($user->profile_picture != "user-default.jpg" && |
|
| 123 | 123 | $user->profile_picture != "user-default-male.png" && |
| 124 | 124 | $user->profile_picture != "user-default-female.png") { |
| 125 | 125 | |
@@ -146,14 +146,14 @@ discard block |
||
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | |
| 149 | - if($this->currentUser()->id == $id) { |
|
| 149 | + if ($this->currentUser()->id == $id) { |
|
| 150 | 150 | $user->name = $request->input('name'); |
| 151 | 151 | $user->biography = $request->input('bio'); |
| 152 | 152 | $user->gender = $request->input('gender'); |
| 153 | 153 | $user->profile_picture = $img; |
| 154 | 154 | $user->save(); |
| 155 | 155 | |
| 156 | - return redirect (route('user.profile.edit', ['id' => $id]))->with('success', 'Profil berhasil diperbarui !'); |
|
| 156 | + return redirect(route('user.profile.edit', [ 'id' => $id ]))->with('success', 'Profil berhasil diperbarui !'); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | return redirect()->back()->with('warning', 'Anda tidak berhak untuk mengakses laman tersebut.'); |
@@ -175,10 +175,10 @@ discard block |
||
| 175 | 175 | |
| 176 | 176 | $user = $this->currentUser(); |
| 177 | 177 | |
| 178 | - if($this->validatePass($request->input('old_password'))) { |
|
| 178 | + if ($this->validatePass($request->input('old_password'))) { |
|
| 179 | 179 | $user->password = Hash::make($request->input('new_password')); |
| 180 | 180 | |
| 181 | - if($user->save()) { |
|
| 181 | + if ($user->save()) { |
|
| 182 | 182 | session()->flush(); |
| 183 | 183 | |
| 184 | 184 | return redirect(route('login'))->with('success', 'Password berhasil diubah ! Silahkan login kembali.'); |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | public function showArticle($id) |
| 197 | 197 | { |
| 198 | 198 | $article = Articles::find($id); |
| 199 | - return view('viewarticle')->with('article',$article); |
|
| 199 | + return view('viewarticle')->with('article', $article); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | |
@@ -208,23 +208,23 @@ discard block |
||
| 208 | 208 | $user = $this->currentUser(); |
| 209 | 209 | $img = null; |
| 210 | 210 | |
| 211 | - if( $user->profile_picture != "user-default.jpg" && |
|
| 211 | + if ($user->profile_picture != "user-default.jpg" && |
|
| 212 | 212 | $user->profile_picture != "user-default-male.png" && |
| 213 | 213 | $user->profile_picture != "user-default-female.png") { |
| 214 | 214 | |
| 215 | 215 | Storage::delete('public/user_images/'.$user->profile_picture); |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - if( $user->gender != null && $user->gender == "Laki - laki") { |
|
| 218 | + if ($user->gender != null && $user->gender == "Laki - laki") { |
|
| 219 | 219 | $img = "user-default-male.png"; |
| 220 | - } elseif($user->gender != null && $user->gender == "Perempuan") { |
|
| 220 | + } elseif ($user->gender != null && $user->gender == "Perempuan") { |
|
| 221 | 221 | $img = "user-default-female.png"; |
| 222 | 222 | } else { |
| 223 | 223 | $img = "user-default.jpg"; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | $user->profile_picture = $img; |
| 227 | - if($user->save()) { |
|
| 227 | + if ($user->save()) { |
|
| 228 | 228 | return redirect(route('user.profile.edit', $user->id))->with('success', 'Foto profil dihapus !'); |
| 229 | 229 | } |
| 230 | 230 | } |
@@ -236,14 +236,14 @@ discard block |
||
| 236 | 236 | public function destroy() |
| 237 | 237 | { |
| 238 | 238 | $user = $this->currentUser(); |
| 239 | - if( $user->profile_picture != "user-default.jpg" && |
|
| 239 | + if ($user->profile_picture != "user-default.jpg" && |
|
| 240 | 240 | $user->profile_picture != "user-default-male.png" && |
| 241 | 241 | $user->profile_picture != "user-default-female.png") { |
| 242 | 242 | |
| 243 | 243 | Storage::delete('public/user_images/'.$user->profile_picture); |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | - if($user->delete()) { |
|
| 246 | + if ($user->delete()) { |
|
| 247 | 247 | session()->flush(); |
| 248 | 248 | return redirect(route('home'))->with('success', 'Akun berhasil dihapus !'); |
| 249 | 249 | } |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | private function validatePass(string $oldPassword) |
| 267 | 267 | { |
| 268 | 268 | $user = $this->currentUser(); |
| 269 | - if(Hash::check($oldPassword, $user->password)) { |
|
| 269 | + if (Hash::check($oldPassword, $user->password)) { |
|
| 270 | 270 | return true; |
| 271 | 271 | } |
| 272 | 272 | return false; |
@@ -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,22 +198,22 @@ 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 | $data = [ |
| 203 | 203 | 'location' => $location, |
| 204 | 204 | ]; |
| 205 | - return view ('SearchRS')->with('data',$data); |
|
| 205 | + return view('SearchRS')->with('data', $data); |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | public function searchHospital(Request $request) |
| 209 | 209 | { |
| 210 | - $hospital = Hospital::where('city_id',$request->location)->orderBy('name')->paginate(5); |
|
| 211 | - $location = City::orderBy('name','asc')->pluck('name','id'); |
|
| 210 | + $hospital = Hospital::where('city_id', $request->location)->orderBy('name')->paginate(5); |
|
| 211 | + $location = City::orderBy('name', 'asc')->pluck('name', 'id'); |
|
| 212 | 212 | $data = [ |
| 213 | 213 | 'hospital' => $hospital, |
| 214 | 214 | 'location' => $location |
| 215 | 215 | ]; |
| 216 | - return view ('listHospital')->with('data',$data); |
|
| 216 | + return view('listHospital')->with('data', $data); |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | public function viewHospital($id) |
@@ -223,6 +223,6 @@ discard block |
||
| 223 | 223 | 'hospital' => $hospital, |
| 224 | 224 | 'room' => $this->getRooms($id), |
| 225 | 225 | ]; |
| 226 | - return view ('viewhospital')->with('data',$data); |
|
| 226 | + return view('viewhospital')->with('data', $data); |
|
| 227 | 227 | } |
| 228 | 228 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | public function index() |
| 22 | 22 | { |
| 23 | 23 | $doctors = Doctor::orderBy('created_at', 'desc')->paginate(10); |
| 24 | - if(!$doctors) { |
|
| 24 | + if (!$doctors) { |
|
| 25 | 25 | abort(503); |
| 26 | 26 | } |
| 27 | 27 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | public function store(Request $request) |
| 54 | 54 | { |
| 55 | - $this->validate($request,[ |
|
| 55 | + $this->validate($request, [ |
|
| 56 | 56 | 'specialty' => 'required', |
| 57 | 57 | 'name' => 'required|min:3|max:50', |
| 58 | 58 | 'license' => 'required|min:3|max:191', |
@@ -69,11 +69,11 @@ discard block |
||
| 69 | 69 | $doctor->email = $request->input('email'); |
| 70 | 70 | $doctor->password = Hash::make($request->password); |
| 71 | 71 | |
| 72 | - if($doctor->save()) { |
|
| 73 | - return redirect (route('doctor.index'))->with('success', 'Berhasil Menambahkan Dokter !'); |
|
| 72 | + if ($doctor->save()) { |
|
| 73 | + return redirect(route('doctor.index'))->with('success', 'Berhasil Menambahkan Dokter !'); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - return redirect (route('doctor.index'))->with('failed', 'Gagal menambah dokter !'); |
|
| 76 | + return redirect(route('doctor.index'))->with('failed', 'Gagal menambah dokter !'); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /** |
@@ -84,20 +84,20 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public function show($id) |
| 86 | 86 | { |
| 87 | - $doctor = Doctor::where('specialization_id',$id)->orderBy('name','asc')->paginate(5); |
|
| 88 | - $location = City::orderBy('name','asc')->pluck('name','id'); |
|
| 87 | + $doctor = Doctor::where('specialization_id', $id)->orderBy('name', 'asc')->paginate(5); |
|
| 88 | + $location = City::orderBy('name', 'asc')->pluck('name', 'id'); |
|
| 89 | 89 | $data = [ |
| 90 | 90 | 'doctor' => $doctor, |
| 91 | 91 | 'location' => $location |
| 92 | 92 | ]; |
| 93 | - return view('listDoctor')->with('data',$data); |
|
| 93 | + return view('listDoctor')->with('data', $data); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | public function showDoctor($id) |
| 97 | 97 | { |
| 98 | 98 | $doctor = Doctor::find($id); |
| 99 | 99 | |
| 100 | - return view('viewDoctor')->with('doctor',$doctor); |
|
| 100 | + return view('viewDoctor')->with('doctor', $doctor); |
|
| 101 | 101 | } |
| 102 | 102 | /** |
| 103 | 103 | * Show the form for editing the specified resource. |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | public function update(Request $request, $id) |
| 127 | 127 | { |
| 128 | - $this->validate($request,[ |
|
| 128 | + $this->validate($request, [ |
|
| 129 | 129 | 'name' => 'required|min:3|max:50', |
| 130 | 130 | 'password' => 'required_with:password_confirmation|same:password_confirmation|min:6', |
| 131 | 131 | 'password_confirmation' => 'min:6' |
@@ -135,41 +135,41 @@ discard block |
||
| 135 | 135 | $doctor = Doctor::find($id); |
| 136 | 136 | $doctor->name = $request->input('name'); |
| 137 | 137 | $doctor->password = $pass; |
| 138 | - if($doctor->save()) { |
|
| 139 | - return redirect (route('doctor.index'))->with('success', 'Doktor berhasil di update !'); |
|
| 138 | + if ($doctor->save()) { |
|
| 139 | + return redirect(route('doctor.index'))->with('success', 'Doktor berhasil di update !'); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - return redirect (route('doctor.edit', $id))->with('failed', 'Gagal memperbaharui dokter !'); |
|
| 142 | + return redirect(route('doctor.edit', $id))->with('failed', 'Gagal memperbaharui dokter !'); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | public function searchDoctor(Request $request) |
| 146 | 146 | { |
| 147 | - if($request->nama == null AND $request->location != null){ |
|
| 148 | - $doctor = Doctor::where('city_id',$request->location)->orderBy('name','asc')->paginate(5); |
|
| 149 | - }elseif ($request->location == null AND $request->nama != null){ |
|
| 150 | - $doctor = Doctor::where('name','LIKE','%'.$request->nama.'%')->orderBy('name','asc')->paginate(5); |
|
| 151 | - }else{ |
|
| 152 | - $doctor = Doctor::where('name','LIKE','%'.$request->nama.'%')->where('city_id',$request->location)->orderBy('name','asc')->paginate(5); |
|
| 147 | + if ($request->nama == null AND $request->location != null) { |
|
| 148 | + $doctor = Doctor::where('city_id', $request->location)->orderBy('name', 'asc')->paginate(5); |
|
| 149 | + }elseif ($request->location == null AND $request->nama != null) { |
|
| 150 | + $doctor = Doctor::where('name', 'LIKE', '%'.$request->nama.'%')->orderBy('name', 'asc')->paginate(5); |
|
| 151 | + } else { |
|
| 152 | + $doctor = Doctor::where('name', 'LIKE', '%'.$request->nama.'%')->where('city_id', $request->location)->orderBy('name', 'asc')->paginate(5); |
|
| 153 | 153 | } |
| 154 | - $location = City::orderBy('name','asc')->pluck('name','id'); |
|
| 154 | + $location = City::orderBy('name', 'asc')->pluck('name', 'id'); |
|
| 155 | 155 | $data = [ |
| 156 | 156 | 'doctor' => $doctor, |
| 157 | 157 | 'location' => $location |
| 158 | 158 | ]; |
| 159 | 159 | |
| 160 | - return view('listDoctor')->with('data',$data); |
|
| 160 | + return view('listDoctor')->with('data', $data); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | public function searchByRadio(Request $request) |
| 164 | 164 | { |
| 165 | - $locationId = City::where('name','LIKE','%'.$request->location.'%')->pluck('id','name'); |
|
| 166 | - $doctor = Doctor::where('city_id',$locationId)->orderBy('name','asc')->paginate(5); |
|
| 167 | - $location = City::orderBy('name','asc')->pluck('name','id'); |
|
| 165 | + $locationId = City::where('name', 'LIKE', '%'.$request->location.'%')->pluck('id', 'name'); |
|
| 166 | + $doctor = Doctor::where('city_id', $locationId)->orderBy('name', 'asc')->paginate(5); |
|
| 167 | + $location = City::orderBy('name', 'asc')->pluck('name', 'id'); |
|
| 168 | 168 | $data = [ |
| 169 | 169 | 'doctor'=>$doctor, |
| 170 | 170 | 'location' => $location |
| 171 | 171 | ]; |
| 172 | - return view('listDoctor')->with('data',$data); |
|
| 172 | + return view('listDoctor')->with('data', $data); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | /** |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | $doctor = Doctor::find($id); |
| 184 | 184 | $doctor->delete(); |
| 185 | 185 | |
| 186 | - return redirect (route('doctor.index')); |
|
| 186 | + return redirect(route('doctor.index')); |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | } |