Passed
Push — master ( d58bf8...6af014 )
by Faiq
04:49
created
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.
app/Doctor.php 1 patch
Braces   +7 added lines, -5 removed lines patch added patch discarded remove patch
@@ -9,8 +9,7 @@  discard block
 block discarded – undo
9 9
 use Illuminate\Contracts\Auth\MustVerifyEmail;
10 10
 use Illuminate\Foundation\Auth\User as Authenticatable;
11 11
 
12
-class Doctor extends Authenticatable
13
-{
12
+class Doctor extends Authenticatable {
14 13
     use Notifiable;
15 14
 
16 15
     protected $guard = 'doctor';
@@ -72,15 +71,18 @@  discard block
 block discarded – undo
72 71
         return $this->belongsTo('App\DoctorSpecialization', 'specialization_id');
73 72
     }
74 73
 
75
-    public function city() {
74
+    public function city()
75
+    {
76 76
         return $this->belongsTo('App\City', 'city_id');
77 77
     }
78 78
 
79
-    public function thread() {
79
+    public function thread()
80
+    {
80 81
         return $this->hasMany('App\Thread', 'doctor_id');
81 82
     }
82 83
 
83
-    public function hospital() {
84
+    public function hospital()
85
+    {
84 86
         return $this->belongsToMany('App\Hospital', 'doctor_details', 'doctor_id', 'hospital_id');
85 87
     }
86 88
 
Please login to merge, or discard this patch.
app/Hospital.php 1 patch
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -4,8 +4,7 @@  discard block
 block discarded – undo
4 4
 
5 5
 use Illuminate\Database\Eloquent\Model;
6 6
 
7
-class Hospital extends Model
8
-{
7
+class Hospital extends Model {
9 8
     /**
10 9
      * @var string
11 10
      */
@@ -40,7 +39,8 @@  discard block
 block discarded – undo
40 39
     /**
41 40
      * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
42 41
      */
43
-    public function doctor() {
42
+    public function doctor()
43
+    {
44 44
         return $this->belongsToMany('App\Doctor', 'doctor_details', 'hospital_id', 'doctor_id');
45 45
     }
46 46
 
Please login to merge, or discard this patch.