Passed
Push — master ( d58bf8...6af014 )
by Faiq
04:49
created
app/Http/Controllers/UserController.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -20,10 +20,10 @@  discard block
 block discarded – undo
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
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     public function index()
34 34
     {
35 35
         $threads = Thread::orderBy('created_at', 'desc')->paginate(5);
36
-        $articles = Articles::where('category','penyakit')->orderBy('created_at','desc')->take(3)->get();
36
+        $articles = Articles::where('category', 'penyakit')->orderBy('created_at', 'desc')->take(3)->get();
37 37
         $data = [
38 38
             'threads' => $threads,
39 39
             'articles' => $articles
@@ -51,11 +51,11 @@  discard block
 block discarded – undo
51 51
     public function profile($query)
52 52
     {
53 53
         $threads = null;
54
-        if($query == "all") {
54
+        if ($query == "all") {
55 55
             $threads = Thread::where('user_id', $this->currentUser()->id)
56 56
                             ->orderBy('updated_at', 'desc')
57 57
                             ->paginate(3);
58
-        } elseif($query == "answered") {
58
+        } elseif ($query == "answered") {
59 59
             $threads = Thread::where('user_id', $this->currentUser()->id)
60 60
                             ->where('status', true)
61 61
                             ->orderBy('updated_at', 'desc')
@@ -78,11 +78,11 @@  discard block
 block discarded – undo
78 78
     public function edit($id)
79 79
     {
80 80
         $user = $this->currentUser();
81
-        if($user->id == $id) {
81
+        if ($user->id == $id) {
82 82
             $data = [
83 83
                 'user' => $user
84 84
             ];
85
-            return view ('profile-edit')->with('data', $data);
85
+            return view('profile-edit')->with('data', $data);
86 86
         }
87 87
         return redirect()->back()->with('warning', 'Anda tidak berhak untuk mengakses laman tersebut.');
88 88
     }
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
     public function editPass($id)
96 96
     {
97 97
         $user = $this->currentUser();
98
-        if($user->id == $id) {
98
+        if ($user->id == $id) {
99 99
             $data = [
100 100
                 'user' => $user
101 101
             ];
102
-            return view ('profile-password')->with('data', $data);
102
+            return view('profile-password')->with('data', $data);
103 103
         }
104 104
         return redirect()->back()->with('warning', 'Anda tidak berhak untuk mengakses laman tersebut.');
105 105
     }
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
      */
114 114
     public function update(Request $request, $id)
115 115
     {
116
-        $this->validate($request,[
116
+        $this->validate($request, [
117 117
             'name' => 'required|min:3',
118 118
             'email' => 'required|email',
119 119
             'image' => 'image|nullable|max:3999'
@@ -122,9 +122,9 @@  discard block
 block discarded – undo
122 122
         $img = null;
123 123
         $user = $this->currentUser();
124 124
 
125
-        if($request->hasFile('image')) {
125
+        if ($request->hasFile('image')) {
126 126
 
127
-            if( $user->profile_picture != "user-default.jpg" &&
127
+            if ($user->profile_picture != "user-default.jpg" &&
128 128
                 $user->profile_picture != "user-default-male.png" &&
129 129
                 $user->profile_picture != "user-default-female.png") {
130 130
 
@@ -151,14 +151,14 @@  discard block
 block discarded – undo
151 151
         }
152 152
 
153 153
 
154
-        if($this->currentUser()->id == $id) {
154
+        if ($this->currentUser()->id == $id) {
155 155
             $user->name = $request->input('name');
156 156
             $user->biography = $request->input('bio');
157 157
             $user->gender = $request->input('gender');
158 158
             $user->profile_picture = $img;
159 159
             $user->save();
160 160
 
161
-            return redirect (route('user.profile.edit', ['id' => $id]))->with('success', 'Profil berhasil diperbarui !');
161
+            return redirect(route('user.profile.edit', [ 'id' => $id ]))->with('success', 'Profil berhasil diperbarui !');
162 162
         }
163 163
 
164 164
         return redirect()->back()->with('warning', 'Anda tidak berhak untuk mengakses laman tersebut.');
@@ -180,10 +180,10 @@  discard block
 block discarded – undo
180 180
 
181 181
         $user = $this->currentUser();
182 182
 
183
-        if($this->validatePass($request->input('old_password'))) {
183
+        if ($this->validatePass($request->input('old_password'))) {
184 184
             $user->password = Hash::make($request->input('new_password'));
185 185
 
186
-            if($user->save()) {
186
+            if ($user->save()) {
187 187
                 session()->flush();
188 188
 
189 189
                 return redirect(route('login'))->with('success', 'Password berhasil diubah ! Silahkan login kembali.');
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
     public function showArticle($id)
202 202
     {
203 203
         $article = Articles::find($id);
204
-        return view('viewarticle')->with('article',$article);
204
+        return view('viewarticle')->with('article', $article);
205 205
     }
206 206
 
207 207
 
@@ -213,23 +213,23 @@  discard block
 block discarded – undo
213 213
         $user = $this->currentUser();
214 214
         $img = null;
215 215
 
216
-        if( $user->profile_picture != "user-default.jpg" &&
216
+        if ($user->profile_picture != "user-default.jpg" &&
217 217
             $user->profile_picture != "user-default-male.png" &&
218 218
             $user->profile_picture != "user-default-female.png") {
219 219
 
220 220
             Storage::delete('public/user_images/'.$user->profile_picture);
221 221
         }
222 222
 
223
-        if( $user->gender != null && $user->gender == "Laki - laki") {
223
+        if ($user->gender != null && $user->gender == "Laki - laki") {
224 224
             $img = "user-default-male.png";
225
-        } elseif($user->gender != null && $user->gender == "Perempuan") {
225
+        } elseif ($user->gender != null && $user->gender == "Perempuan") {
226 226
             $img = "user-default-female.png";
227 227
         } else {
228 228
             $img = "user-default.jpg";
229 229
         }
230 230
 
231 231
         $user->profile_picture = $img;
232
-        if($user->save()) {
232
+        if ($user->save()) {
233 233
             return redirect(route('user.profile.edit', $user->id))->with('success', 'Foto profil dihapus !');
234 234
         }
235 235
     }
@@ -241,14 +241,14 @@  discard block
 block discarded – undo
241 241
     public function destroy()
242 242
     {
243 243
         $user = $this->currentUser();
244
-        if( $user->profile_picture != "user-default.jpg" &&
244
+        if ($user->profile_picture != "user-default.jpg" &&
245 245
             $user->profile_picture != "user-default-male.png" &&
246 246
             $user->profile_picture != "user-default-female.png") {
247 247
 
248 248
             Storage::delete('public/user_images/'.$user->profile_picture);
249 249
         }
250 250
 
251
-        if($user->delete()) {
251
+        if ($user->delete()) {
252 252
             session()->flush();
253 253
             return redirect(route('home'))->with('success', 'Akun berhasil dihapus !');
254 254
         }
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
     private function validatePass(string $oldPassword)
272 272
     {
273 273
         $user = $this->currentUser();
274
-        if(Hash::check($oldPassword, $user->password)) {
274
+        if (Hash::check($oldPassword, $user->password)) {
275 275
             return true;
276 276
         }
277 277
         return false;
Please login to merge, or discard this patch.
app/Http/Controllers/ArticleController.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
      */
16 16
     public function index()
17 17
     {
18
-        $articles = Articles::orderBy('created_at','desc')->paginate(15);
18
+        $articles = Articles::orderBy('created_at', 'desc')->paginate(15);
19 19
         $data = [
20 20
             'articles' => $articles
21 21
         ];
@@ -38,20 +38,20 @@  discard block
 block discarded – undo
38 38
      */
39 39
     public function store(Request $request)
40 40
     {
41
-        $this->validate($request,[
41
+        $this->validate($request, [
42 42
             'category' => 'required',
43 43
             'title' => 'required',
44 44
             'content' => 'required|min:500',
45 45
             'cover_image' => 'image|nullable|max:3999'
46 46
         ]);
47 47
 
48
-        if($request->hasFile('cover_image')){
48
+        if ($request->hasFile('cover_image')) {
49 49
             $filenameWithExt = $request->file('cover_image')->getClientOriginalName();
50 50
             $filename = pathinfo($filenameWithExt, PATHINFO_FILENAME);
51 51
             $extension = $request->file('cover_image')->getClientOriginalExtension();
52 52
             $fileNameToStore = $filename.'_'.time().'.'.$extension;
53 53
             $path = $request->file('cover_image')->storeAs('public/cover_images', $fileNameToStore);
54
-        }else {
54
+        } else {
55 55
             $fileNameToStore = 'noimage.jpg';
56 56
         }
57 57
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         $article->category = $request->input('category');
60 60
         $article->title = $request->input('title');
61 61
         $article->content = $request->input('content');
62
-        if(session('guard') == 'admin') {
62
+        if (session('guard') == 'admin') {
63 63
             $article->admin_id = Auth::guard('admin')->user()->id;
64 64
         } else {
65 65
             $article->doctor_id = Auth::guard('doctor')->user()->id;
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         $article->cover_image = $fileNameToStore;
68 68
 
69 69
         $log = null;
70
-        if($article->save()) {
70
+        if ($article->save()) {
71 71
             $log = Common::registerLog([
72 72
                 'action' => "membuat artikel baru.",
73 73
                 'target' => 'article',
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
             ]);
79 79
         }
80 80
 
81
-        if($log != null && $log == true) {
82
-            return redirect (route(session('guard').'.article.index'))->with('success', 'Artikel baru berhasil ditambahkan !');
81
+        if ($log != null && $log == true) {
82
+            return redirect(route(session('guard').'.article.index'))->with('success', 'Artikel baru berhasil ditambahkan !');
83 83
         }
84 84
 
85 85
         return redirect(route(session('guard').'.article.create'))->with('failed', 'Gagal menambahkan artikel.');
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     public function show($id)
93 93
     {
94 94
         $article = Articles::find($id);
95
-        if(!$article) {
95
+        if (!$article) {
96 96
             abort(404);
97 97
         }
98 98
         return view('pages.ext.view-article')->with('article', $article);
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
         }
126 126
 
127 127
         $data = [
128
-            'articles' => Articles::where('category', $cat)->orderBy('title','asc')->get(),
128
+            'articles' => Articles::where('category', $cat)->orderBy('title', 'asc')->get(),
129 129
             'category' => $category,
130 130
             'cat' => $cat
131 131
         ];
@@ -156,8 +156,8 @@  discard block
 block discarded – undo
156 156
         }
157 157
             $data = [
158 158
                 'articles' => Articles::where('category', $cat)
159
-                                        ->where('title','LIKE',$name.'%')
160
-                                        ->orderBy('title','asc')
159
+                                        ->where('title', 'LIKE', $name.'%')
160
+                                        ->orderBy('title', 'asc')
161 161
                                         ->get(),
162 162
                 'category' => $category,
163 163
                 'cat' => $cat
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
     {
171 171
         $cari = $request->cari;
172 172
         $articles = Articles::where('category', $cat)
173
-                        ->where('content','LIKE','%'.$cari.'%')
174
-                        ->orderBy('title','asc')
173
+                        ->where('content', 'LIKE', '%'.$cari.'%')
174
+                        ->orderBy('title', 'asc')
175 175
                         ->get();
176 176
         $category = null;
177 177
         switch ($cat) {
@@ -207,11 +207,11 @@  discard block
 block discarded – undo
207 207
     public function edit($id)
208 208
     {
209 209
         $article = Articles::find($id);
210
-        if(!$article) {
210
+        if (!$article) {
211 211
             abort(404);
212 212
         }
213 213
 
214
-        if($article->writer()['data']->id != Auth::guard(session('guard'))->user()->id) {
214
+        if ($article->writer()[ 'data' ]->id != Auth::guard(session('guard'))->user()->id) {
215 215
             return redirect(session('guard').'/article')->with('warning', 'Anda tidak berhak untuk mengubah Artikel tersebut.');
216 216
         }
217 217
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
      */
230 230
     public function update(Request $request, $id)
231 231
     {
232
-        $this->validate($request,[
232
+        $this->validate($request, [
233 233
             'category' => 'required',
234 234
             'title' => 'required',
235 235
             'content' => 'required|min:500',
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 
238 238
         ]);
239 239
 
240
-        if($request->hasFile('cover_image')){
240
+        if ($request->hasFile('cover_image')) {
241 241
             $filenameWithExt = $request->file('cover_image')->getClientOriginalName();
242 242
             $filename = pathinfo($filenameWithExt, PATHINFO_FILENAME);
243 243
             $extension = $request->file('cover_image')->getClientOriginalExtension();
@@ -249,12 +249,12 @@  discard block
 block discarded – undo
249 249
         $article->category = $request->input('category');
250 250
         $article->title = $request->input('title');
251 251
         $article->content = $request->input('content');
252
-        if($request->hasFile('cover_image')){
252
+        if ($request->hasFile('cover_image')) {
253 253
             $article->cover_image = $fileNameToStore;
254 254
         }
255 255
 
256 256
         $log = null;
257
-        if($article->save()) {
257
+        if ($article->save()) {
258 258
             $log = Common::registerLog([
259 259
                 'action' => "membuat perubahan pada artikelnya.",
260 260
                 'target' => 'article',
@@ -265,11 +265,11 @@  discard block
 block discarded – undo
265 265
             ]);
266 266
         }
267 267
 
268
-        if($log != null && $log == true) {
269
-            return redirect (route(session('guard').'.article.index'))->with('success', 'Artikel berhasil diubah !');
268
+        if ($log != null && $log == true) {
269
+            return redirect(route(session('guard').'.article.index'))->with('success', 'Artikel berhasil diubah !');
270 270
         }
271 271
 
272
-        return redirect (route(session('guard').'.article.edit', $id))->with('failed', 'Gagal mengubah artikel !');
272
+        return redirect(route(session('guard').'.article.edit', $id))->with('failed', 'Gagal mengubah artikel !');
273 273
     }
274 274
 
275 275
     /**
@@ -280,18 +280,18 @@  discard block
 block discarded – undo
280 280
     {
281 281
         $article = Articles::find($id);
282 282
 
283
-        if($article->cover_image != 'noimage.jpg'){
283
+        if ($article->cover_image != 'noimage.jpg') {
284 284
             Storage::delete('public/cover_images/'.$article->cover_image);
285 285
         }
286 286
 
287 287
         $unreg = null;
288
-        if($article->delete()) {
288
+        if ($article->delete()) {
289 289
             $unreg = Common::unregisterLog([
290 290
                 'target' => 'article',
291 291
                 'target_id' => $id
292 292
             ]);
293 293
         }
294
-        if($unreg != null && $unreg) {
294
+        if ($unreg != null && $unreg) {
295 295
             return redirect()->back()->with('success', 'Artikel dihapus !');
296 296
         }
297 297
 
Please login to merge, or discard this patch.
app/Http/Controllers/HospitalController.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -17,12 +17,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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,8 +154,8 @@  discard block
 block discarded – undo
154 154
         $hospital = Hospital::find($id);
155 155
         $delrooms = $this->deleteRoomsAndRoomDetail($id);
156 156
 
157
-        if($delrooms){
158
-            if($hospital->delete()) {
157
+        if ($delrooms) {
158
+            if ($hospital->delete()) {
159 159
                 return redirect(route('hospital.index'))->with('success', 'Rumah sakit dihapus !');
160 160
             }
161 161
             return redirect(route('hospital.index'))->with('failed', 'Gagal menghapus rumah sakit !');
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
     {
172 172
         $rooms = $this->getRooms($hospital_id);
173 173
         $ids = $rooms->pluck('id')->toArray();
174
-        if(count($ids) < 1) {
174
+        if (count($ids) < 1) {
175 175
             return true;
176 176
         }
177 177
 
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
             ->where('hospital_id', '=', $hospital_id)
181 181
             ->delete();
182 182
 
183
-        if($delroom && $deldetail) {
183
+        if ($delroom && $deldetail) {
184 184
             return true;
185 185
         }
186 186
 
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
         $rooms = DB::table('rooms')
197 197
             ->selectRaw(DB::raw('rooms.*'))
198 198
             ->leftJoin('room_details', 'rooms.id', '=', 'room_details.room_id')
199
-            ->where('room_details.hospital_id','=',$hospital_id)
199
+            ->where('room_details.hospital_id', '=', $hospital_id)
200 200
             ->get();
201 201
 
202 202
         return $rooms;
@@ -204,13 +204,13 @@  discard block
 block discarded – undo
204 204
 
205 205
     public function indexUser()
206 206
     {
207
-        $location = City::orderBy('name','asc')->pluck('name', 'id');
207
+        $location = City::orderBy('name', 'asc')->pluck('name', 'id');
208 208
         $img = 'storage/images/hospital-icon.jpg';
209 209
         $data = [
210 210
             'img' => $img,
211 211
             'location' => $location
212 212
         ];
213
-        return view ('SearchRS')->with('data',$data);
213
+        return view('SearchRS')->with('data', $data);
214 214
     }
215 215
 
216 216
     public function showList()
@@ -220,30 +220,30 @@  discard block
 block discarded – undo
220 220
 
221 221
     public function searchHospital(Request $request)
222 222
     {
223
-        if($request->nama == null AND $request->location != null){
224
-            $hospital = Hospital::where('city_id',$request->location)->orderBy('name','asc')->paginate(5);
225
-        }elseif ($request->location == null AND $request->nama != null){
226
-            $hospital = Hospital::where('biography','LIKE','%'.$request->nama.'%')->orderBy('name','asc')->paginate(5);
227
-        }else{
228
-            $hospital = Hospital::where('biography','LIKE','%'.$request->nama.'%')->where('city_id',$request->location)->orderBy('name','asc')->paginate(5);
223
+        if ($request->nama == null AND $request->location != null) {
224
+            $hospital = Hospital::where('city_id', $request->location)->orderBy('name', 'asc')->paginate(5);
225
+        }elseif ($request->location == null AND $request->nama != null) {
226
+            $hospital = Hospital::where('biography', 'LIKE', '%'.$request->nama.'%')->orderBy('name', 'asc')->paginate(5);
227
+        } else {
228
+            $hospital = Hospital::where('biography', 'LIKE', '%'.$request->nama.'%')->where('city_id', $request->location)->orderBy('name', 'asc')->paginate(5);
229 229
         }
230
-        $location = City::orderBy('name','asc')->pluck('name','id');
230
+        $location = City::orderBy('name', 'asc')->pluck('name', 'id');
231 231
         $data = [
232 232
             'hospital' => $hospital,
233 233
             'location' => $location
234 234
         ];
235
-        return view ('listHospital')->with('data',$data);
235
+        return view('listHospital')->with('data', $data);
236 236
     }
237 237
 
238 238
     public function searchContent($content)
239 239
     {
240
-        $hospital = Hospital::where('biography','LIKE','%'.$content.'%')->orderBy('name','asc')->paginate(5);
241
-        $location = City::orderBy('name','asc')->pluck('name','id');
240
+        $hospital = Hospital::where('biography', 'LIKE', '%'.$content.'%')->orderBy('name', 'asc')->paginate(5);
241
+        $location = City::orderBy('name', 'asc')->pluck('name', 'id');
242 242
         $data = [
243 243
             'hospital' => $hospital,
244 244
             'location' => $location
245 245
         ];
246
-        return view ('listHospital')->with('data',$data);
246
+        return view('listHospital')->with('data', $data);
247 247
     }
248 248
 
249 249
     public function viewHospital($id)
@@ -253,6 +253,6 @@  discard block
 block discarded – undo
253 253
             'hospital' => $hospital,
254 254
             'room' => $this->getRooms($id),
255 255
         ];
256
-        return view ('viewhospital')->with('data',$data);
256
+        return view('viewhospital')->with('data', $data);
257 257
     }
258 258
 }
Please login to merge, or discard this patch.
app/Http/Controllers/RoomController.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
                 'updated_at' => Carbon::now()
49 49
             ));
50 50
 
51
-        if($room_id != null && $hospital_id != null) {
51
+        if ($room_id != null && $hospital_id != null) {
52 52
             $data = [
53 53
                 'hospital_id' => $hospital_id,
54 54
                 'room_id' => $room_id
55 55
             ];
56 56
 
57
-            if($this->insertRoomDetails($data) && $this->updateHospitalUpdatedAt($hospital_id)) {
57
+            if ($this->insertRoomDetails($data) && $this->updateHospitalUpdatedAt($hospital_id)) {
58 58
                 return redirect(route('hospital.show', $hospital_id))->with('success', 'Kamar baru berhasil ditambahkan !');
59 59
             }
60 60
         }
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 
115 115
         $hospital = $this->updateHospitalUpdatedAt($request->input('hospital_id'));
116 116
 
117
-        if($room->save() && $hospital == true) {
117
+        if ($room->save() && $hospital == true) {
118 118
             return redirect(route('hospital.show', $request->input('hospital_id')))->with('success', 'Detil Kamar berhasil diubah !');
119 119
         }
120 120
     }
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
         $hospital = $this->updateHospitalUpdatedAt($hospital_id);
133 133
         $detail = $this->deleteRoomDetails($room_id, $hospital_id);
134 134
 
135
-        if($room && $hospital && $detail) {
136
-            return redirect(route('hospital.show', ['id' => $hospital_id]))->with('success', 'Kamar dihapus !');
135
+        if ($room && $hospital && $detail) {
136
+            return redirect(route('hospital.show', [ 'id' => $hospital_id ]))->with('success', 'Kamar dihapus !');
137 137
         }
138 138
     }
139 139
 
@@ -145,11 +145,11 @@  discard block
 block discarded – undo
145 145
     {
146 146
         $insert = DB::table('room_details')
147 147
             ->insert([
148
-                'room_id' => $data['room_id'],
149
-                'hospital_id' => $data['hospital_id']
148
+                'room_id' => $data[ 'room_id' ],
149
+                'hospital_id' => $data[ 'hospital_id' ]
150 150
             ]);
151 151
 
152
-        if($insert) {
152
+        if ($insert) {
153 153
             return true;
154 154
         }
155 155
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
             ->where('hospital_id', '=', $hospital_id)
169 169
             ->delete();
170 170
 
171
-        if($delete) {
171
+        if ($delete) {
172 172
             return true;
173 173
         }
174 174
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
     {
184 184
         $hospital = Hospital::find($id);
185 185
         $hospital->updated_at = Carbon::now();
186
-        if($hospital->save()) {
186
+        if ($hospital->save()) {
187 187
             return true;
188 188
         }
189 189
 
Please login to merge, or discard this patch.
app/Http/Controllers/DocController.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -48,12 +48,12 @@  discard block
 block discarded – undo
48 48
 
49 49
         ];
50 50
 
51
-        if( $doctor->city_id == null ||
51
+        if ($doctor->city_id == null ||
52 52
             $doctor->gender == null ||
53 53
             $doctor->biography == null ||
54 54
             $doctor->profile_picture == 'user-default.jpg') {
55 55
 
56
-            $data['warning'] = 'Sepertinya anda belum melengkapi data diri anda, segera lengkapi data diri anda.';
56
+            $data[ 'warning' ] = 'Sepertinya anda belum melengkapi data diri anda, segera lengkapi data diri anda.';
57 57
         }
58 58
         return view('pages.dashboard')->with('data', $data);
59 59
     }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     public function profile($id)
68 68
     {
69 69
         $doctor = $this->currentUser();
70
-        if($doctor->id == $id) {
70
+        if ($doctor->id == $id) {
71 71
             $data = [
72 72
                 'doctor' => $doctor
73 73
             ];
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     public function edit($id)
87 87
     {
88 88
         $doctor = $this->currentUser();
89
-        if($doctor->id == $id) {
89
+        if ($doctor->id == $id) {
90 90
             $specialization = DoctorSpecialization::pluck('name', 'id');
91 91
             $cities = City::pluck('name', 'id');
92 92
 
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
         $doctor = $this->currentUser();
125 125
         $img = null;
126 126
 
127
-        if($request->hasFile('profile_picture')) {
127
+        if ($request->hasFile('profile_picture')) {
128 128
 
129
-            if( $doctor->profile_picture != "user-default.jpg") {
129
+            if ($doctor->profile_picture != "user-default.jpg") {
130 130
                 Storage::delete('public/user_images/'.$doctor->profile_picture);
131 131
             }
132 132
 
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
         $doctor->gender = $request->input('gender');
149 149
         $doctor->specialization_id = $request->input('specialization_id');
150 150
         $doctor->biography = $request->input('biography');
151
-        if($request->hasFile('profile_picture')) {
151
+        if ($request->hasFile('profile_picture')) {
152 152
             $doctor->profile_picture = $img;
153 153
         }
154 154
 
155
-        if($doctor->save()) {
155
+        if ($doctor->save()) {
156 156
             return redirect(route('doctor.profile', $doctor->id))->with('success', 'Profil berhasil diperbarui !');
157 157
         }
158 158
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
     public function editPass($id)
169 169
     {
170 170
         $doctor = $this->currentUser();
171
-        if($doctor->id == $id) {
171
+        if ($doctor->id == $id) {
172 172
             $data = [
173 173
                 'doctor' => $doctor
174 174
             ];
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
     public function updatePass(Request $request, $id)
190 190
     {
191 191
         $doctor = $this->currentUser();
192
-        if($this->validatePass($request->input('old_password'))) {
193
-            if($request->input('old_password') == $request->input('new_password')) {
192
+        if ($this->validatePass($request->input('old_password'))) {
193
+            if ($request->input('old_password') == $request->input('new_password')) {
194 194
                 return redirect(route('doctor.password.edit', $doctor->id))->with('warning', 'Password baru tidak boleh sama dengan Password lama.');
195 195
             }
196 196
 
@@ -216,12 +216,12 @@  discard block
 block discarded – undo
216 216
     public function removeImage()
217 217
     {
218 218
         $doctor = $this->currentUser();
219
-        if($doctor->profile_picture != "user-default.jpg") {
219
+        if ($doctor->profile_picture != "user-default.jpg") {
220 220
             Storage::delete('public/user_images/'.$doctor->profile_picture);
221 221
         }
222 222
 
223 223
         $doctor->profile_picture = "user-default.jpg";
224
-        if($doctor->save()) {
224
+        if ($doctor->save()) {
225 225
             return redirect(route('doctor.profile.edit', $doctor->id))->with('success', 'Foto profil berhasil dihapus !');
226 226
         }
227 227
         return redirect(route('doctor.profile.edit', $doctor->id))->with('failed', 'Gagal menghapus foto profil.');
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
     public function destroy()
236 236
     {
237 237
         $doctor = $this->currentUser();
238
-        if($doctor->delete()) {
238
+        if ($doctor->delete()) {
239 239
             session()->flush();
240 240
             return redirect(route('doctor.login'))->with('success', 'Akun telah dihapus !');
241 241
         }
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
     public function hospital($id)
252 252
     {
253 253
         $doctor = $this->currentUser();
254
-        if($doctor->id == $id) {
254
+        if ($doctor->id == $id) {
255 255
             $data = [
256 256
                 'doctor' => $doctor,
257 257
                 'hospitals' => Hospital::where('city_id', $doctor->city_id)->paginate(5),
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
         $dd->doctor_id = $this->currentUser()->id;
274 274
         $dd->hospital_id = $request->input('hospital_id');
275 275
 
276
-        if($dd->save()) {
276
+        if ($dd->save()) {
277 277
             return redirect(route('doctor.profile.hospital', $this->currentUser()->id))->with('success', 'Rumah Sakit baru ditambahkan !');
278 278
         }
279 279
         return redirect(route('doctor.profile.hospital', $this->currentUser()->id))->with('failed', 'Gagal menambah Rumah Sakit.');
@@ -281,13 +281,13 @@  discard block
 block discarded – undo
281 281
 
282 282
     public function unregHospital($doctorId, $hospitalId)
283 283
     {
284
-        if($this->currentUser()->id != $doctorId) {
284
+        if ($this->currentUser()->id != $doctorId) {
285 285
             return redirect()->back()->with('warning', 'Anda tidak berhak mengakses laman tersebut.');
286 286
         }
287 287
         $dd = DoctorDetail::where('doctor_id', $this->currentUser()->id)
288 288
             ->where('hospital_id', $hospitalId);
289
-        if($dd != null) {
290
-            if($dd->delete()) {
289
+        if ($dd != null) {
290
+            if ($dd->delete()) {
291 291
                 return redirect(route('doctor.profile.hospital', $this->currentUser()->id))->with('success', 'Rumah Sakit dihapus !');
292 292
             }
293 293
             return redirect(route('doctor.profile.hospital', $this->currentUser()->id))->with('failed', 'Gagal menghapus Rumah Sakit, Data tidak ditemukan.');
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
     private function validatePass(string $oldPassword)
315 315
     {
316 316
         $doctor = $this->currentUser();
317
-        if(Hash::check($oldPassword, $doctor->password)) {
317
+        if (Hash::check($oldPassword, $doctor->password)) {
318 318
             return true;
319 319
         }
320 320
 
Please login to merge, or discard this patch.