Completed
Push — master ( 0bfc5e...68d7a2 )
by Faiq
18s
created
app/DoctorSpecialization.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
app/Hospital.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
app/Http/Controllers/AdminController.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
             'role' => session('role'),
48 48
             'admin' => $admin,
49 49
         ];
50
-        return view('pages.admin')->with('data',$data);
50
+        return view('pages.admin')->with('data', $data);
51 51
     }
52 52
 
53 53
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         $data = [
61 61
             'role' => session('role')
62 62
         ];
63
-        return view ('pages.ext.add-admin')->with('data',$data);
63
+        return view('pages.ext.add-admin')->with('data', $data);
64 64
     }
65 65
 
66 66
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
      */
72 72
     public function store(Request $request)
73 73
     {
74
-        $this->validate($request,[
74
+        $this->validate($request, [
75 75
             'name' => 'required|min:3|max:50',
76 76
             'email' => 'required|email',
77 77
             'password' => 'required_with:password_confirmation|same:password_confirmation|min:6',
@@ -83,11 +83,11 @@  discard block
 block discarded – undo
83 83
         $admin->email = $request->input('email');
84 84
         $admin->password = Hash::make($request->input('password'));
85 85
 
86
-        if($admin->save()) {
87
-            return redirect (route('admin.index'))->with('success', 'Admin berhasil di tambahkan !');
86
+        if ($admin->save()) {
87
+            return redirect(route('admin.index'))->with('success', 'Admin berhasil di tambahkan !');
88 88
         }
89 89
 
90
-        return redirect (route('admin.index'))->with('failed', 'Gagal menambah admin !');
90
+        return redirect(route('admin.index'))->with('failed', 'Gagal menambah admin !');
91 91
     }
92 92
 
93 93
 
@@ -145,9 +145,9 @@  discard block
 block discarded – undo
145 145
 
146 146
             $img = null;
147 147
 
148
-            if($request->hasFile('profile_picture')) {
148
+            if ($request->hasFile('profile_picture')) {
149 149
 
150
-                if( $admin->profile_picture != "user-default.jpg") {
150
+                if ($admin->profile_picture != "user-default.jpg") {
151 151
                     Storage::delete('public/user_images/'.$admin->profile_picture);
152 152
                 }
153 153
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 
166 166
             $admin->name = $request->input('name');
167 167
             $admin->email = $request->input('email');
168
-            if($request->hasFile('profile_picture')) {
168
+            if ($request->hasFile('profile_picture')) {
169 169
                 $admin->profile_picture = $img;
170 170
             }
171 171
             $admin->save();
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
     public function editPass($id)
185 185
     {
186 186
         $admin = $this->currentUser();
187
-        if($admin->id == $id) {
187
+        if ($admin->id == $id) {
188 188
             $data = [
189 189
                 'admin' => $admin
190 190
             ];
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
     public function updatePass(Request $request, $id)
205 205
     {
206 206
         $admin = $this->currentUser();
207
-        if($admin->id == $id) {
207
+        if ($admin->id == $id) {
208 208
 
209 209
             $this->validate($request, [
210 210
                 'old_password' => 'required|min:6',
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
                 'password_confirmation' => 'required|min:6'
213 213
             ]);
214 214
 
215
-            if($this->validatePass($request->input('old_password'))) {
215
+            if ($this->validatePass($request->input('old_password'))) {
216 216
                 $admin->password = Hash::make($request->input('new_password'));
217 217
                 $admin->save();
218 218
 
@@ -232,12 +232,12 @@  discard block
 block discarded – undo
232 232
     public function removeImage()
233 233
     {
234 234
         $admin = $this->currentUser();
235
-        if($admin->profile_picture != "user-default.jpg") {
235
+        if ($admin->profile_picture != "user-default.jpg") {
236 236
             Storage::delete('public/user_images/'.$admin->profile_picture);
237 237
         }
238 238
 
239 239
         $admin->profile_picture = "user-default.jpg";
240
-        if($admin->save()) {
240
+        if ($admin->save()) {
241 241
             return redirect(route('admin.profile.edit', $admin->id))->with('success', 'Foto profil berhasil dihapus !');
242 242
         }
243 243
     }
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
     public function destroy() {
250 250
         $admin = $this->currentUser();
251 251
 
252
-        if($admin->delete()) {
252
+        if ($admin->delete()) {
253 253
 
254 254
             session()->flush();
255 255
             return redirect(route('admin.login', $admin->id))->with('success', 'Akun berhasil dihapus !');
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
     private function validatePass(string $oldPassword)
276 276
     {
277 277
         $admin = $this->currentUser();
278
-        if(Hash::check($oldPassword, $admin->password)) {
278
+        if (Hash::check($oldPassword, $admin->password)) {
279 279
             return true;
280 280
         }
281 281
 
Please login to merge, or discard this patch.
app/Http/Controllers/DocController.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -41,12 +41,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
app/Http/Controllers/SpecializationController.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
app/Http/Controllers/ArticleController.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
      */
15 15
     public function index()
16 16
     {
17
-        $articles = Articles::orderBy('category','asc')->paginate(5);
17
+        $articles = Articles::orderBy('category', 'asc')->paginate(5);
18 18
         $data = [
19 19
             'articles' => $articles
20 20
         ];
@@ -37,20 +37,20 @@  discard block
 block discarded – undo
37 37
      */
38 38
     public function store(Request $request)
39 39
     {
40
-        $this->validate($request,[
40
+        $this->validate($request, [
41 41
             'category' => 'required',
42 42
             'title' => 'required',
43 43
             'content' => 'required|min:500',
44 44
             'cover_image' => 'image|nullable|max:3999'
45 45
         ]);
46 46
 
47
-        if($request->hasFile('cover_image')){
47
+        if ($request->hasFile('cover_image')) {
48 48
             $filenameWithExt = $request->file('cover_image')->getClientOriginalName();
49 49
             $filename = pathinfo($filenameWithExt, PATHINFO_FILENAME);
50 50
             $extension = $request->file('cover_image')->getClientOriginalExtension();
51 51
             $fileNameToStore = $filename.'_'.time().'.'.$extension;
52 52
             $path = $request->file('cover_image')->storeAs('public/cover_images', $fileNameToStore);
53
-        }else {
53
+        } else {
54 54
             $fileNameToStore = 'noimage.jpg';
55 55
         }
56 56
 
@@ -58,15 +58,15 @@  discard block
 block discarded – undo
58 58
         $article->category = $request->input('category');
59 59
         $article->title = $request->input('title');
60 60
         $article->content = $request->input('content');
61
-        if(session('guard') == 'admin') {
61
+        if (session('guard') == 'admin') {
62 62
             $article->admin_id = Auth::guard('admin')->user()->id;
63 63
         } else {
64 64
             $article->doctor_id = Auth::guard('doctor')->user()->id;
65 65
         }
66 66
         $article->cover_image = $fileNameToStore;
67 67
 
68
-        if($article->save()) {
69
-            return redirect (route(session('guard').'.article.index'))->with('success', 'Artikel baru berhasil ditambahkan !');
68
+        if ($article->save()) {
69
+            return redirect(route(session('guard').'.article.index'))->with('success', 'Artikel baru berhasil ditambahkan !');
70 70
         }
71 71
 
72 72
         return redirect(route(session('guard').'.article.create'))->with('failed', 'Gagal menambahkan artikel.');
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     public function show($id)
80 80
     {
81 81
         $article = Articles::find($id);
82
-        if(!$article) {
82
+        if (!$article) {
83 83
             abort(404);
84 84
         }
85 85
         return view('pages.ext.view-article')->with('article', $article);
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         }
113 113
 
114 114
         $data = [
115
-            'articles' => Articles::where('category', $cat)->orderBy('title','asc')->get(),
115
+            'articles' => Articles::where('category', $cat)->orderBy('title', 'asc')->get(),
116 116
             'category' => $category,
117 117
             'cat' => $cat
118 118
         ];
@@ -143,8 +143,8 @@  discard block
 block discarded – undo
143 143
         }
144 144
             $data = [
145 145
                 'articles' => Articles::where('category', $cat)
146
-                                        ->where('title','LIKE',$name.'%')
147
-                                        ->orderBy('title','asc')
146
+                                        ->where('title', 'LIKE', $name.'%')
147
+                                        ->orderBy('title', 'asc')
148 148
                                         ->get(),
149 149
                 'category' => $category,
150 150
                 'cat' => $cat
@@ -157,8 +157,8 @@  discard block
 block discarded – undo
157 157
     {
158 158
         $cari = $request->cari;
159 159
         $articles = Articles::where('category', $cat)
160
-                        ->where('content','LIKE','%'.$cari.'%')
161
-                        ->orderBy('title','asc')
160
+                        ->where('content', 'LIKE', '%'.$cari.'%')
161
+                        ->orderBy('title', 'asc')
162 162
                         ->get();
163 163
         $category = null;
164 164
         switch ($cat) {
@@ -194,11 +194,11 @@  discard block
 block discarded – undo
194 194
     public function edit($id)
195 195
     {
196 196
         $article = Articles::find($id);
197
-        if(!$article) {
197
+        if (!$article) {
198 198
             abort(404);
199 199
         }
200 200
 
201
-        if($article->writer()['data']->id != Auth::guard(session('guard'))->user()->id) {
201
+        if ($article->writer()[ 'data' ]->id != Auth::guard(session('guard'))->user()->id) {
202 202
             return redirect(session('guard').'/article')->with('warning', 'Anda tidak berhak untuk mengubah Artikel tersebut.');
203 203
         }
204 204
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
      */
217 217
     public function update(Request $request, $id)
218 218
     {
219
-        $this->validate($request,[
219
+        $this->validate($request, [
220 220
             'category' => 'required',
221 221
             'title' => 'required',
222 222
             'content' => 'required|min:500',
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 
225 225
         ]);
226 226
 
227
-        if($request->hasFile('cover_image')){
227
+        if ($request->hasFile('cover_image')) {
228 228
             $filenameWithExt = $request->file('cover_image')->getClientOriginalName();
229 229
             $filename = pathinfo($filenameWithExt, PATHINFO_FILENAME);
230 230
             $extension = $request->file('cover_image')->getClientOriginalExtension();
@@ -236,15 +236,15 @@  discard block
 block discarded – undo
236 236
         $article->category = $request->input('category');
237 237
         $article->title = $request->input('title');
238 238
         $article->content = $request->input('content');
239
-        if($request->hasFile('cover_image')){
239
+        if ($request->hasFile('cover_image')) {
240 240
             $article->cover_image = $fileNameToStore;
241 241
         }
242 242
 
243
-        if($article->save()) {
244
-            return redirect (route(session('guard').'.article.index'))->with('success', 'Artikel berhasil diubah !');
243
+        if ($article->save()) {
244
+            return redirect(route(session('guard').'.article.index'))->with('success', 'Artikel berhasil diubah !');
245 245
         }
246 246
 
247
-        return redirect (route(session('guard').'.article.edit', $id))->with('failed', 'Gagal mengubah artikel !');
247
+        return redirect(route(session('guard').'.article.edit', $id))->with('failed', 'Gagal mengubah artikel !');
248 248
     }
249 249
 
250 250
     /**
@@ -255,11 +255,11 @@  discard block
 block discarded – undo
255 255
     {
256 256
         $article = Articles::find($id);
257 257
 
258
-        if($article->cover_image != 'noimage.jpg'){
258
+        if ($article->cover_image != 'noimage.jpg') {
259 259
             Storage::delete('public/cover_images/'.$article->cover_image);
260 260
         }
261 261
 
262
-        if($article->delete()) {
262
+        if ($article->delete()) {
263 263
             return redirect()->back()->with('success', 'Artikel dihapus !');
264 264
         }
265 265
 
Please login to merge, or discard this patch.
app/Http/Controllers/HospitalController.php 1 patch
Spacing   +12 added lines, -12 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,7 +154,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
app/Http/Controllers/DoctorController.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
         abort(503);
24 24
 
25 25
         $doctors = Doctor::all();
26
-        if(!$doctors) {
26
+        if (!$doctors) {
27 27
             abort(503);
28 28
         }
29 29
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      */
55 55
     public function store(Request $request)
56 56
     {
57
-        $this->validate($request,[
57
+        $this->validate($request, [
58 58
             'specialty' => 'required',
59 59
             'name' => 'required|min:3|max:50',
60 60
             'license' => 'required|min:3|max:191',
@@ -71,11 +71,11 @@  discard block
 block discarded – undo
71 71
         $doctor->email = $request->input('email');
72 72
         $doctor->password = Hash::make($request->password);
73 73
 
74
-        if($doctor->save()) {
75
-            return redirect (route('doctor.index'))->with('success', 'Berhasil Menambahkan Dokter !');
74
+        if ($doctor->save()) {
75
+            return redirect(route('doctor.index'))->with('success', 'Berhasil Menambahkan Dokter !');
76 76
         }
77 77
 
78
-        return redirect (route('doctor.index'))->with('failed', 'Gagal menambah dokter !');
78
+        return redirect(route('doctor.index'))->with('failed', 'Gagal menambah dokter !');
79 79
     }
80 80
 
81 81
     /**
@@ -86,20 +86,20 @@  discard block
 block discarded – undo
86 86
      */
87 87
     public function show($id)
88 88
     {
89
-        $doctor = Doctor::where('specialization_id',$id)->orderBy('name','asc')->paginate(5);
90
-        $location = City::orderBy('name','asc')->pluck('name','id');
89
+        $doctor = Doctor::where('specialization_id', $id)->orderBy('name', 'asc')->paginate(5);
90
+        $location = City::orderBy('name', 'asc')->pluck('name', 'id');
91 91
         $data = [
92 92
             'doctor' => $doctor,
93 93
             'location' => $location
94 94
         ];
95
-        return view('listDoctor')->with('data',$data);
95
+        return view('listDoctor')->with('data', $data);
96 96
     }
97 97
 
98 98
     public function showDoctor($id)
99 99
     {
100 100
         $doctor = Doctor::find($id);
101 101
 
102
-        return view('viewDoctor')->with('doctor',$doctor);
102
+        return view('viewDoctor')->with('doctor', $doctor);
103 103
     }
104 104
     /**
105 105
      * Show the form for editing the specified resource.
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
      */
128 128
     public function update(Request $request, $id)
129 129
     {
130
-        $this->validate($request,[
130
+        $this->validate($request, [
131 131
             'name' => 'required|min:3|max:50',
132 132
             'password' => 'required_with:password_confirmation|same:password_confirmation|min:6',
133 133
             'password_confirmation' => 'min:6'
@@ -137,41 +137,41 @@  discard block
 block discarded – undo
137 137
         $doctor = Doctor::find($id);
138 138
         $doctor->name = $request->input('name');
139 139
         $doctor->password = $pass;
140
-        if($doctor->save()) {
141
-            return redirect (route('doctor.index'))->with('success', 'Doktor berhasil di update !');
140
+        if ($doctor->save()) {
141
+            return redirect(route('doctor.index'))->with('success', 'Doktor berhasil di update !');
142 142
         }
143 143
 
144
-        return redirect (route('doctor.edit', $id))->with('failed', 'Gagal memperbaharui dokter !');
144
+        return redirect(route('doctor.edit', $id))->with('failed', 'Gagal memperbaharui dokter !');
145 145
     }
146 146
 
147 147
     public function searchDoctor(Request $request)
148 148
     {
149
-        if($request->nama == null AND $request->location != null){
150
-            $doctor = Doctor::where('city_id',$request->location)->orderBy('name','asc')->paginate(5);
151
-        }elseif ($request->location == null AND $request->nama != null){
152
-            $doctor = Doctor::where('name','LIKE','%'.$request->nama.'%')->orderBy('name','asc')->paginate(5);
153
-        }else{
154
-            $doctor = Doctor::where('name','LIKE','%'.$request->nama.'%')->where('city_id',$request->location)->orderBy('name','asc')->paginate(5);
149
+        if ($request->nama == null AND $request->location != null) {
150
+            $doctor = Doctor::where('city_id', $request->location)->orderBy('name', 'asc')->paginate(5);
151
+        }elseif ($request->location == null AND $request->nama != null) {
152
+            $doctor = Doctor::where('name', 'LIKE', '%'.$request->nama.'%')->orderBy('name', 'asc')->paginate(5);
153
+        } else {
154
+            $doctor = Doctor::where('name', 'LIKE', '%'.$request->nama.'%')->where('city_id', $request->location)->orderBy('name', 'asc')->paginate(5);
155 155
         }
156
-        $location = City::orderBy('name','asc')->pluck('name','id');
156
+        $location = City::orderBy('name', 'asc')->pluck('name', 'id');
157 157
         $data = [
158 158
             'doctor' => $doctor,
159 159
             'location' => $location
160 160
         ];
161 161
 
162
-        return view('listDoctor')->with('data',$data);
162
+        return view('listDoctor')->with('data', $data);
163 163
     }
164 164
 
165 165
     public function searchByRadio(Request $request)
166 166
     {
167
-        $locationId = City::where('name','LIKE','%'.$request->location.'%')->pluck('id','name');
168
-        $doctor = Doctor::where('city_id',$locationId)->orderBy('name','asc')->paginate(5);
169
-        $location = City::orderBy('name','asc')->pluck('name','id');
167
+        $locationId = City::where('name', 'LIKE', '%'.$request->location.'%')->pluck('id', 'name');
168
+        $doctor = Doctor::where('city_id', $locationId)->orderBy('name', 'asc')->paginate(5);
169
+        $location = City::orderBy('name', 'asc')->pluck('name', 'id');
170 170
         $data = [
171 171
             'doctor'=>$doctor,
172 172
             'location' => $location
173 173
         ];
174
-        return view('listDoctor')->with('data',$data);
174
+        return view('listDoctor')->with('data', $data);
175 175
     }
176 176
 
177 177
     /**
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
         $doctor = Doctor::find($id);
186 186
         $doctor->delete();
187 187
 
188
-        return redirect (route('doctor.index'));
188
+        return redirect(route('doctor.index'));
189 189
     }
190 190
 
191 191
 }
Please login to merge, or discard this patch.
app/Thread.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.