Passed
Pull Request — master (#40)
by
unknown
05:36
created
app/User.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
      */
52 52
     public function trimStr(string $str)
53 53
     {
54
-        if(strlen($str) > 50) {
54
+        if (strlen($str) > 50) {
55 55
             return substr($str, '0', '50')."...";
56 56
         }
57 57
         return $str;
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,8 +7,7 @@
 block discarded – undo
7 7
 use Carbon\Carbon;
8 8
 use Illuminate\Foundation\Auth\User as Authenticatable;
9 9
 
10
-class User extends Authenticatable
11
-{
10
+class User extends Authenticatable {
12 11
     use Notifiable;
13 12
 
14 13
     /**
Please login to merge, or discard this patch.
app/Doctor.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@
 block discarded – undo
78 78
      */
79 79
     public function trimStr($str)
80 80
     {
81
-        if(strlen($str) > 20) {
81
+        if (strlen($str) > 20) {
82 82
             return substr($str, 0, 20)."...";
83 83
         }
84 84
         return $str;
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,8 +7,7 @@
 block discarded – undo
7 7
 use Illuminate\Contracts\Auth\MustVerifyEmail;
8 8
 use Illuminate\Foundation\Auth\User as Authenticatable;
9 9
 
10
-class Doctor extends Authenticatable
11
-{
10
+class Doctor extends Authenticatable {
12 11
     use Notifiable;
13 12
 
14 13
     protected $guard = 'doctor';
Please login to merge, or discard this patch.
app/City.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
     /**
33 33
      * @return \Illuminate\Database\Eloquent\Relations\HasMany
34 34
      */
35
-    public function hospital(){
35
+    public function hospital() {
36 36
         return $this->hasMany('App\Hospital');
37 37
     }
38 38
 }
Please login to merge, or discard this 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 City extends Model
8
-{
7
+class City extends Model {
9 8
     /**
10 9
      * @var string
11 10
      */
@@ -32,7 +31,8 @@  discard block
 block discarded – undo
32 31
     /**
33 32
      * @return \Illuminate\Database\Eloquent\Relations\HasMany
34 33
      */
35
-    public function hospital(){
34
+    public function hospital()
35
+    {
36 36
         return $this->hasMany('App\Hospital');
37 37
     }
38 38
 }
Please login to merge, or discard this patch.
app/DoctorSpecialization.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
      * @return string
35 35
      */
36 36
     public function trimStr($str) {
37
-        if(strlen($str) > 15) {
37
+        if (strlen($str) > 15) {
38 38
             return substr($str, 0, 15)."...";
39 39
         }
40 40
         return $str;
Please login to merge, or discard this 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 DoctorSpecialization extends Model
8
-{
7
+class DoctorSpecialization extends Model {
9 8
     /**
10 9
      * @var string
11 10
      */
@@ -33,7 +32,8 @@  discard block
 block discarded – undo
33 32
      * @param $str
34 33
      * @return string
35 34
      */
36
-    public function trimStr($str) {
35
+    public function trimStr($str)
36
+    {
37 37
         if(strlen($str) > 15) {
38 38
             return substr($str, 0, 15)."...";
39 39
         }
Please login to merge, or discard this patch.
app/Hospital.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
34 34
      */
35 35
     public function city() {
36
-        return $this->belongsTo('App\City','city_id');
36
+        return $this->belongsTo('App\City', 'city_id');
37 37
     }
38 38
 
39 39
     /**
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      * @return string
42 42
      */
43 43
     public function trimStr($str) {
44
-        if(strlen($str) > 10) {
44
+        if (strlen($str) > 10) {
45 45
             return substr($str, 0, 10)."...";
46 46
         }
47 47
         return $str;
Please login to merge, or discard this patch.
Braces   +5 added lines, -4 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
      */
@@ -32,7 +31,8 @@  discard block
 block discarded – undo
32 31
     /**
33 32
      * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
34 33
      */
35
-    public function city() {
34
+    public function city()
35
+    {
36 36
         return $this->belongsTo('App\City','city_id');
37 37
     }
38 38
 
@@ -40,7 +40,8 @@  discard block
 block discarded – undo
40 40
      * @param $str
41 41
      * @return string
42 42
      */
43
-    public function trimStr($str) {
43
+    public function trimStr($str)
44
+    {
44 45
         if(strlen($str) > 10) {
45 46
             return substr($str, 0, 10)."...";
46 47
         }
Please login to merge, or discard this patch.
app/Http/Middleware/Authenticate.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,10 +14,10 @@
 block discarded – undo
14 14
      */
15 15
     protected function redirectTo($request)
16 16
     {
17
-        if (! $request->expectsJson()) {
18
-            if($request->is('admin') || $request->is('admin/*')) {
17
+        if (!$request->expectsJson()) {
18
+            if ($request->is('admin') || $request->is('admin/*')) {
19 19
                 return route('admin.login');
20
-            } else if($request->is('doctor') || $request->is('doctor/*')) {
20
+            } else if ($request->is('doctor') || $request->is('doctor/*')) {
21 21
                 return route('doctor.login');
22 22
             } else {
23 23
                 return route('login');
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,7 @@
 block discarded – undo
4 4
 
5 5
 use Illuminate\Auth\Middleware\Authenticate as Middleware;
6 6
 
7
-class Authenticate extends Middleware
8
-{
7
+class Authenticate extends Middleware {
9 8
     /**
10 9
      * Get the path the user should be redirected to when they are not authenticated.
11 10
      *
Please login to merge, or discard this patch.
app/Http/Middleware/RedirectIfAuthenticated.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
                 break;
31 31
             default:
32 32
                 if (Auth::guard($guard)->check()) {
33
-                     return redirect()->route('home');
33
+                        return redirect()->route('home');
34 34
                 }
35 35
         }
36 36
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@
 block discarded – undo
17 17
      */
18 18
     public function handle($request, Closure $next, $guard = null)
19 19
     {
20
-        switch($guard) {
20
+        switch ($guard) {
21 21
             case 'admin':
22
-                if(Auth::guard($guard)->check()) {
22
+                if (Auth::guard($guard)->check()) {
23 23
                     return redirect()->route('admin.index');
24 24
                 }
25 25
                 break;
26 26
             case 'doctor':
27
-                if(Auth::guard($guard)->check()) {
27
+                if (Auth::guard($guard)->check()) {
28 28
                     return redirect()->route('admin.index');
29 29
                 }
30 30
                 break;
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,8 +5,7 @@
 block discarded – undo
5 5
 use Closure;
6 6
 use Illuminate\Support\Facades\Auth;
7 7
 
8
-class RedirectIfAuthenticated
9
-{
8
+class RedirectIfAuthenticated {
10 9
     /**
11 10
      * Handle an incoming request.
12 11
      *
Please login to merge, or discard this patch.
app/Http/Controllers/RoomController.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -47,13 +47,13 @@  discard block
 block discarded – undo
47 47
                 'updated_at' => Carbon::now()
48 48
             ));
49 49
 
50
-        if($room_id != null && $hospital_id != null) {
50
+        if ($room_id != null && $hospital_id != null) {
51 51
             $data = [
52 52
                 'hospital_id' => $hospital_id,
53 53
                 'room_id' => $room_id
54 54
             ];
55 55
 
56
-            if($this->insertRoomDetails($data) && $this->updateHospitalUpdatedAt($hospital_id)) {
56
+            if ($this->insertRoomDetails($data) && $this->updateHospitalUpdatedAt($hospital_id)) {
57 57
                 return redirect(route('hospital.show', $hospital_id));
58 58
             }
59 59
         }
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 
113 113
         $hospital = $this->updateHospitalUpdatedAt($request->input('hospital_id'));
114 114
 
115
-        if($room->save() && $hospital == true) {
115
+        if ($room->save() && $hospital == true) {
116 116
             return redirect(route('hospital.show', $request->input('hospital_id')));
117 117
         }
118 118
     }
@@ -130,8 +130,8 @@  discard block
 block discarded – undo
130 130
         $hospital = $this->updateHospitalUpdatedAt($hospital_id);
131 131
         $detail = $this->deleteRoomDetails($room_id, $hospital_id);
132 132
 
133
-        if($room && $hospital && $detail) {
134
-            return redirect(route('hospital.show', ['id' => $hospital_id]));
133
+        if ($room && $hospital && $detail) {
134
+            return redirect(route('hospital.show', [ 'id' => $hospital_id ]));
135 135
         }
136 136
     }
137 137
 
@@ -143,11 +143,11 @@  discard block
 block discarded – undo
143 143
     {
144 144
         $insert = DB::table('room_details')
145 145
             ->insert([
146
-                'room_id' => $data['room_id'],
147
-                'hospital_id' => $data['hospital_id']
146
+                'room_id' => $data[ 'room_id' ],
147
+                'hospital_id' => $data[ 'hospital_id' ]
148 148
             ]);
149 149
 
150
-        if($insert) {
150
+        if ($insert) {
151 151
             return true;
152 152
         }
153 153
 
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
             ->where('hospital_id', '=', $hospital_id)
167 167
             ->delete();
168 168
 
169
-        if($delete) {
169
+        if ($delete) {
170 170
             return true;
171 171
         }
172 172
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
     {
182 182
         $hospital = Hospital::find($id);
183 183
         $hospital->updated_at = Carbon::now();
184
-        if($hospital->save()) {
184
+        if ($hospital->save()) {
185 185
             return true;
186 186
         }
187 187
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,8 +8,7 @@
 block discarded – undo
8 8
 use App\Hospital;
9 9
 use App\Room;
10 10
 
11
-class RoomController extends Controller
12
-{
11
+class RoomController extends Controller {
13 12
     /**
14 13
      * Show the form for creating a new resource.
15 14
      *
Please login to merge, or discard this patch.
app/Http/Controllers/UserController.php 2 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
      */
20 20
     public function __construct()
21 21
     {
22
-        $this->middleware('auth', ['except' => [
22
+        $this->middleware('auth', [ 'except' => [
23 23
             'index',
24 24
             'showArticle'
25
-        ]]);
25
+        ] ]);
26 26
     }
27 27
 
28 28
 
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
      */
32 32
     public function index()
33 33
     {
34
-        $article = Articles::orderBy('created_at','desc')->take(3)->get();
34
+        $article = Articles::orderBy('created_at', 'desc')->take(3)->get();
35 35
         return view('home')->with('article', $article);
36 36
     }
37 37
 
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
     public function edit($id)
56 56
     {
57 57
         $user = $this->currentUser();
58
-        if($user->id == $id) {
58
+        if ($user->id == $id) {
59 59
             $data = [
60 60
                 'user' => $user
61 61
             ];
62
-            return view ('profile-edit')->with('data', $data);
62
+            return view('profile-edit')->with('data', $data);
63 63
         }
64 64
         return redirect()->back()->with('warning', 'Anda tidak berhak untuk mengakses laman tersebut.');
65 65
     }
@@ -72,11 +72,11 @@  discard block
 block discarded – undo
72 72
     public function editPass($id)
73 73
     {
74 74
         $user = $this->currentUser();
75
-        if($user->id == $id) {
75
+        if ($user->id == $id) {
76 76
             $data = [
77 77
                 'user' => $user
78 78
             ];
79
-            return view ('profile-password')->with('data', $data);
79
+            return view('profile-password')->with('data', $data);
80 80
         }
81 81
         return redirect()->back()->with('warning', 'Anda tidak berhak untuk mengakses laman tersebut.');
82 82
     }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      */
91 91
     public function update(Request $request, $id)
92 92
     {
93
-        $this->validate($request,[
93
+        $this->validate($request, [
94 94
             'name' => 'required|min:3',
95 95
             'email' => 'required|email',
96 96
             'image' => 'image|nullable|max:3999'
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
         $img = null;
100 100
         $user = $this->currentUser();
101 101
 
102
-        if($request->hasFile('image')) {
102
+        if ($request->hasFile('image')) {
103 103
 
104
-            if( $user->profile_picture != "user-default.jpg" &&
104
+            if ($user->profile_picture != "user-default.jpg" &&
105 105
                 $user->profile_picture != "user-default-male.png" &&
106 106
                 $user->profile_picture != "user-default-female.png") {
107 107
 
@@ -128,14 +128,14 @@  discard block
 block discarded – undo
128 128
         }
129 129
 
130 130
 
131
-        if($this->currentUser()->id == $id) {
131
+        if ($this->currentUser()->id == $id) {
132 132
             $user->name = $request->input('name');
133 133
             $user->biography = $request->input('bio');
134 134
             $user->gender = $request->input('gender');
135 135
             $user->profile_picture = $img;
136 136
             $user->save();
137 137
 
138
-            return redirect (route('user.profile.edit', ['id' => $id]))->with('success', 'Profil berhasil diperbarui !');
138
+            return redirect(route('user.profile.edit', [ 'id' => $id ]))->with('success', 'Profil berhasil diperbarui !');
139 139
         }
140 140
 
141 141
         return redirect()->back()->with('warning', 'Anda tidak berhak untuk mengakses laman tersebut.');
@@ -157,10 +157,10 @@  discard block
 block discarded – undo
157 157
 
158 158
         $user = $this->currentUser();
159 159
 
160
-        if($this->validatePass($request->input('old_password'))) {
160
+        if ($this->validatePass($request->input('old_password'))) {
161 161
             $user->password = Hash::make($request->input('new_password'));
162 162
 
163
-            if($user->save()) {
163
+            if ($user->save()) {
164 164
                 session()->flush();
165 165
 
166 166
                 return redirect(route('login'))->with('success', 'Password berhasil diubah ! Silahkan login kembali.');
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
     public function showArticle($id)
179 179
     {
180 180
         $article = Articles::find($id);
181
-        return view('viewarticle')->with('article',$article);
181
+        return view('viewarticle')->with('article', $article);
182 182
     }
183 183
 
184 184
 
@@ -190,23 +190,23 @@  discard block
 block discarded – undo
190 190
         $user = $this->currentUser();
191 191
         $img = null;
192 192
 
193
-        if( $user->profile_picture != "user-default.jpg" &&
193
+        if ($user->profile_picture != "user-default.jpg" &&
194 194
             $user->profile_picture != "user-default-male.png" &&
195 195
             $user->profile_picture != "user-default-female.png") {
196 196
 
197 197
             Storage::delete('public/user_images/'.$user->profile_picture);
198 198
         }
199 199
 
200
-        if( $user->gender != null && $user->gender == "Laki - laki") {
200
+        if ($user->gender != null && $user->gender == "Laki - laki") {
201 201
             $img = "user-default-male.png";
202
-        } elseif($user->gender != null && $user->gender == "Perempuan") {
202
+        } elseif ($user->gender != null && $user->gender == "Perempuan") {
203 203
             $img = "user-default-female.png";
204 204
         } else {
205 205
             $img = "user-default.jpg";
206 206
         }
207 207
 
208 208
         $user->profile_picture = $img;
209
-        if($user->save()) {
209
+        if ($user->save()) {
210 210
             return redirect(route('user.profile.edit', $user->id))->with('success', 'Foto profil dihapus !');
211 211
         }
212 212
     }
@@ -218,14 +218,14 @@  discard block
 block discarded – undo
218 218
     public function destroy()
219 219
     {
220 220
         $user = $this->currentUser();
221
-        if( $user->profile_picture != "user-default.jpg" &&
221
+        if ($user->profile_picture != "user-default.jpg" &&
222 222
             $user->profile_picture != "user-default-male.png" &&
223 223
             $user->profile_picture != "user-default-female.png") {
224 224
 
225 225
             Storage::delete('public/user_images/'.$user->profile_picture);
226 226
         }
227 227
 
228
-        if($user->delete()) {
228
+        if ($user->delete()) {
229 229
             session()->flush();
230 230
             return redirect(route('home'))->with('success', 'Akun berhasil dihapus !');
231 231
         }
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
     private function validatePass(string $oldPassword)
249 249
     {
250 250
         $user = $this->currentUser();
251
-        if(Hash::check($oldPassword, $user->password)) {
251
+        if (Hash::check($oldPassword, $user->password)) {
252 252
             return true;
253 253
         }
254 254
         return false;
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,8 +10,7 @@
 block discarded – undo
10 10
 use App\Articles;
11 11
 
12 12
 
13
-class UserController extends Controller
14
-{
13
+class UserController extends Controller {
15 14
     /**
16 15
      * Create a new controller instance.
17 16
      *
Please login to merge, or discard this patch.