Completed
Push — master ( 0bfc5e...68d7a2 )
by Faiq
18s
created
app/Http/Controllers/Auth/ResetPasswordController.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,8 +5,7 @@
 block discarded – undo
5 5
 use App\Http\Controllers\Controller;
6 6
 use Illuminate\Foundation\Auth\ResetsPasswords;
7 7
 
8
-class ResetPasswordController extends Controller
9
-{
8
+class ResetPasswordController extends Controller {
10 9
     /*
11 10
     |--------------------------------------------------------------------------
12 11
     | Password Reset Controller
Please login to merge, or discard this patch.
app/Http/Controllers/UserController.php 2 patches
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.
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
 
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
      */
33 33
     public function index()
34 34
     {
35
-        $article = Articles::where('category','penyakit')->orderBy('created_at','desc')->take(3)->get();
35
+        $article = Articles::where('category', 'penyakit')->orderBy('created_at', 'desc')->take(3)->get();
36 36
         return view('home')->with('article', $article);
37 37
     }
38 38
 
@@ -46,11 +46,11 @@  discard block
 block discarded – undo
46 46
     public function profile($query)
47 47
     {
48 48
         $threads = null;
49
-        if($query == "all") {
49
+        if ($query == "all") {
50 50
             $threads = Thread::where('user_id', $this->currentUser()->id)
51 51
                             ->orderBy('created_at', 'desc')
52 52
                             ->paginate(3);
53
-        } elseif($query == "answered") {
53
+        } elseif ($query == "answered") {
54 54
             $threads = Thread::where('user_id', $this->currentUser()->id)
55 55
                             ->where('status', true)
56 56
                             ->orderBy('created_at', 'desc')
@@ -73,11 +73,11 @@  discard block
 block discarded – undo
73 73
     public function edit($id)
74 74
     {
75 75
         $user = $this->currentUser();
76
-        if($user->id == $id) {
76
+        if ($user->id == $id) {
77 77
             $data = [
78 78
                 'user' => $user
79 79
             ];
80
-            return view ('profile-edit')->with('data', $data);
80
+            return view('profile-edit')->with('data', $data);
81 81
         }
82 82
         return redirect()->back()->with('warning', 'Anda tidak berhak untuk mengakses laman tersebut.');
83 83
     }
@@ -90,11 +90,11 @@  discard block
 block discarded – undo
90 90
     public function editPass($id)
91 91
     {
92 92
         $user = $this->currentUser();
93
-        if($user->id == $id) {
93
+        if ($user->id == $id) {
94 94
             $data = [
95 95
                 'user' => $user
96 96
             ];
97
-            return view ('profile-password')->with('data', $data);
97
+            return view('profile-password')->with('data', $data);
98 98
         }
99 99
         return redirect()->back()->with('warning', 'Anda tidak berhak untuk mengakses laman tersebut.');
100 100
     }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      */
109 109
     public function update(Request $request, $id)
110 110
     {
111
-        $this->validate($request,[
111
+        $this->validate($request, [
112 112
             'name' => 'required|min:3',
113 113
             'email' => 'required|email',
114 114
             'image' => 'image|nullable|max:3999'
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
         $img = null;
118 118
         $user = $this->currentUser();
119 119
 
120
-        if($request->hasFile('image')) {
120
+        if ($request->hasFile('image')) {
121 121
 
122
-            if( $user->profile_picture != "user-default.jpg" &&
122
+            if ($user->profile_picture != "user-default.jpg" &&
123 123
                 $user->profile_picture != "user-default-male.png" &&
124 124
                 $user->profile_picture != "user-default-female.png") {
125 125
 
@@ -146,14 +146,14 @@  discard block
 block discarded – undo
146 146
         }
147 147
 
148 148
 
149
-        if($this->currentUser()->id == $id) {
149
+        if ($this->currentUser()->id == $id) {
150 150
             $user->name = $request->input('name');
151 151
             $user->biography = $request->input('bio');
152 152
             $user->gender = $request->input('gender');
153 153
             $user->profile_picture = $img;
154 154
             $user->save();
155 155
 
156
-            return redirect (route('user.profile.edit', ['id' => $id]))->with('success', 'Profil berhasil diperbarui !');
156
+            return redirect(route('user.profile.edit', [ 'id' => $id ]))->with('success', 'Profil berhasil diperbarui !');
157 157
         }
158 158
 
159 159
         return redirect()->back()->with('warning', 'Anda tidak berhak untuk mengakses laman tersebut.');
@@ -175,10 +175,10 @@  discard block
 block discarded – undo
175 175
 
176 176
         $user = $this->currentUser();
177 177
 
178
-        if($this->validatePass($request->input('old_password'))) {
178
+        if ($this->validatePass($request->input('old_password'))) {
179 179
             $user->password = Hash::make($request->input('new_password'));
180 180
 
181
-            if($user->save()) {
181
+            if ($user->save()) {
182 182
                 session()->flush();
183 183
 
184 184
                 return redirect(route('login'))->with('success', 'Password berhasil diubah ! Silahkan login kembali.');
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
     public function showArticle($id)
197 197
     {
198 198
         $article = Articles::find($id);
199
-        return view('viewarticle')->with('article',$article);
199
+        return view('viewarticle')->with('article', $article);
200 200
     }
201 201
 
202 202
 
@@ -208,23 +208,23 @@  discard block
 block discarded – undo
208 208
         $user = $this->currentUser();
209 209
         $img = null;
210 210
 
211
-        if( $user->profile_picture != "user-default.jpg" &&
211
+        if ($user->profile_picture != "user-default.jpg" &&
212 212
             $user->profile_picture != "user-default-male.png" &&
213 213
             $user->profile_picture != "user-default-female.png") {
214 214
 
215 215
             Storage::delete('public/user_images/'.$user->profile_picture);
216 216
         }
217 217
 
218
-        if( $user->gender != null && $user->gender == "Laki - laki") {
218
+        if ($user->gender != null && $user->gender == "Laki - laki") {
219 219
             $img = "user-default-male.png";
220
-        } elseif($user->gender != null && $user->gender == "Perempuan") {
220
+        } elseif ($user->gender != null && $user->gender == "Perempuan") {
221 221
             $img = "user-default-female.png";
222 222
         } else {
223 223
             $img = "user-default.jpg";
224 224
         }
225 225
 
226 226
         $user->profile_picture = $img;
227
-        if($user->save()) {
227
+        if ($user->save()) {
228 228
             return redirect(route('user.profile.edit', $user->id))->with('success', 'Foto profil dihapus !');
229 229
         }
230 230
     }
@@ -236,14 +236,14 @@  discard block
 block discarded – undo
236 236
     public function destroy()
237 237
     {
238 238
         $user = $this->currentUser();
239
-        if( $user->profile_picture != "user-default.jpg" &&
239
+        if ($user->profile_picture != "user-default.jpg" &&
240 240
             $user->profile_picture != "user-default-male.png" &&
241 241
             $user->profile_picture != "user-default-female.png") {
242 242
 
243 243
             Storage::delete('public/user_images/'.$user->profile_picture);
244 244
         }
245 245
 
246
-        if($user->delete()) {
246
+        if ($user->delete()) {
247 247
             session()->flush();
248 248
             return redirect(route('home'))->with('success', 'Akun berhasil dihapus !');
249 249
         }
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
     private function validatePass(string $oldPassword)
267 267
     {
268 268
         $user = $this->currentUser();
269
-        if(Hash::check($oldPassword, $user->password)) {
269
+        if (Hash::check($oldPassword, $user->password)) {
270 270
             return true;
271 271
         }
272 272
         return false;
Please login to merge, or discard this patch.
app/Http/Controllers/DoctorDetailController.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,8 +5,7 @@
 block discarded – undo
5 5
 use App\DoctorDetail;
6 6
 use Illuminate\Http\Request;
7 7
 
8
-class DoctorDetailController extends Controller
9
-{
8
+class DoctorDetailController extends Controller {
10 9
     /**
11 10
      * Display a listing of the resource.
12 11
      *
Please login to merge, or discard this patch.
app/Http/Controllers/AdminController.php 2 patches
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,8 +9,7 @@  discard block
 block discarded – undo
9 9
 use App\Admin;
10 10
 use Illuminate\Support\Facades\Storage;
11 11
 
12
-class AdminController extends Controller
13
-{
12
+class AdminController extends Controller {
14 13
     /**
15 14
      * AdminController constructor.
16 15
      */
@@ -243,7 +242,8 @@  discard block
 block discarded – undo
243 242
     /**
244 243
      * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
245 244
      */
246
-    public function destroy() {
245
+    public function destroy()
246
+    {
247 247
         $admin = $this->currentUser();
248 248
 
249 249
         if($admin->delete()) {
Please login to merge, or discard this 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/Kernel.php 1 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\Foundation\Http\Kernel as HttpKernel;
6 6
 
7
-class Kernel extends HttpKernel
8
-{
7
+class Kernel extends HttpKernel {
9 8
     /**
10 9
      * The application's global HTTP middleware stack.
11 10
      *
Please login to merge, or discard this patch.
app/Articles.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -38,14 +38,14 @@  discard block
 block discarded – undo
38 38
         $adminId = $this->getAttributeValue('admin_id');
39 39
         $doctorId = $this->getAttributeValue('doctor_id');
40 40
 
41
-        $writer = ['role', 'data'];
41
+        $writer = [ 'role', 'data' ];
42 42
 
43
-        if($adminId != null) {
44
-            $writer['role'] = "Admin";
45
-            $writer['data'] = Admin::find($adminId);
46
-        } elseif($doctorId != null) {
47
-            $writer['role'] = "Dokter";
48
-            $writer['data'] = Doctor::find($doctorId);
43
+        if ($adminId != null) {
44
+            $writer[ 'role' ] = "Admin";
45
+            $writer[ 'data' ] = Admin::find($adminId);
46
+        } elseif ($doctorId != null) {
47
+            $writer[ 'role' ] = "Dokter";
48
+            $writer[ 'data' ] = Doctor::find($doctorId);
49 49
         }
50 50
 
51 51
         return $writer;
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
      */
58 58
     public function cutStr($str)
59 59
     {
60
-        if (strlen($str) > 200){
61
-            return substr($str,0,200) . "...";
60
+        if (strlen($str) > 200) {
61
+            return substr($str, 0, 200)."...";
62 62
         }
63 63
         return $str;
64 64
     }
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
     public function getCat($str)
71 71
     {
72 72
         switch ($str) {
73
-            case "penyakit":    return "Penyakit";      break;
73
+            case "penyakit":    return "Penyakit"; break;
74 74
             case "obat":        return "Obat - obatan"; break;
75
-            case "hidup-sehat": return "Hidup Sehat";   break;
76
-            case "keluarga":    return "Keluarga";      break;
77
-            case "kesehatan":   return "Kesehatan";     break;
75
+            case "hidup-sehat": return "Hidup Sehat"; break;
76
+            case "keluarga":    return "Keluarga"; break;
77
+            case "kesehatan":   return "Kesehatan"; break;
78 78
         }
79 79
     }
80 80
 }
Please login to merge, or discard this patch.
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -5,8 +5,7 @@  discard block
 block discarded – undo
5 5
 use App\Doctor;
6 6
 use Illuminate\Database\Eloquent\Model;
7 7
 
8
-class Articles extends Model
9
-{
8
+class Articles extends Model {
10 9
     /**
11 10
      * @var string
12 11
      */
@@ -33,7 +32,8 @@  discard block
 block discarded – undo
33 32
     /**
34 33
      * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
35 34
      */
36
-    public function admin() {
35
+    public function admin()
36
+    {
37 37
         return $this->belongsTo('App\Admin');
38 38
     }
39 39
 
@@ -41,7 +41,8 @@  discard block
 block discarded – undo
41 41
     /**
42 42
      * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
43 43
      */
44
-    public function doctor() {
44
+    public function doctor()
45
+    {
45 46
         return $this->belongsTo('App\Doctor');
46 47
     }
47 48
 
@@ -49,7 +50,8 @@  discard block
 block discarded – undo
49 50
      * @param $id
50 51
      * @return array
51 52
      */
52
-    public function writer() {
53
+    public function writer()
54
+    {
53 55
         $adminId = $this->getAttributeValue('admin_id');
54 56
         $doctorId = $this->getAttributeValue('doctor_id');
55 57
 
@@ -72,7 +74,7 @@  discard block
 block discarded – undo
72 74
      */
73 75
     public function cutStr($str)
74 76
     {
75
-        if (strlen($str) > 200){
77
+        if (strlen($str) > 200) {
76 78
             return substr($str,0,200) . "...";
77 79
         }
78 80
         return $str;
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
@@ -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.
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
      */
@@ -29,7 +28,8 @@  discard block
 block discarded – undo
29 28
         'updated_at'
30 29
     ];
31 30
 
32
-    public function doctor() {
31
+    public function doctor()
32
+    {
33 33
         return $this->hasOne('App\Doctor', 'specialization_id');
34 34
     }
35 35
 
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
@@ -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.
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\Database\Eloquent\Model;
6 6
 
7
-class Hospital extends Model
8
-{
7
+class Hospital extends Model {
9 8
     /**
10 9
      * @var string
11 10
      */
Please login to merge, or discard this patch.
app/DoctorDetail.php 1 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\Database\Eloquent\Model;
6 6
 
7
-class DoctorDetail extends Model
8
-{
7
+class DoctorDetail extends Model {
9 8
     /**
10 9
      * @var string
11 10
      */
Please login to merge, or discard this patch.