Passed
Push — master ( d58bf8...6af014 )
by Faiq
04:49
created
app/Http/Middleware/VerifyCsrfToken.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\Middleware\VerifyCsrfToken as Middleware;
6 6
 
7
-class VerifyCsrfToken extends Middleware
8
-{
7
+class VerifyCsrfToken extends Middleware {
9 8
     /**
10 9
      * Indicates whether the XSRF-TOKEN cookie should be set on the response.
11 10
      *
Please login to merge, or discard this patch.
app/Http/Middleware/TrimStrings.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\Middleware\TrimStrings as Middleware;
6 6
 
7
-class TrimStrings extends Middleware
8
-{
7
+class TrimStrings extends Middleware {
9 8
     /**
10 9
      * The names of the attributes that should not be trimmed.
11 10
      *
Please login to merge, or discard this patch.
app/Http/Controllers/Controller.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,7 +7,6 @@
 block discarded – undo
7 7
 use Illuminate\Foundation\Validation\ValidatesRequests;
8 8
 use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
9 9
 
10
-class Controller extends BaseController
11
-{
10
+class Controller extends BaseController {
12 11
     use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
13 12
 }
Please login to merge, or discard this patch.
app/Http/Controllers/Auth/OAuthController.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 Illuminate\Validation\ValidationException;
11 11
 use Laravel\Socialite\Facades\Socialite;
12 12
 
13
-class OAuthController extends Controller
14
-{
13
+class OAuthController extends Controller {
15 14
 
16 15
     public function redirectToProvider($provider)
17 16
     {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
         $user = null;
33 33
         $err = null;
34 34
 
35
-        if($provider == 'google') {
35
+        if ($provider == 'google') {
36 36
             $user = Socialite::driver($provider)->stateless()->user();
37 37
         } else {
38 38
             $user = Socialite::driver($provider)->user();
@@ -40,13 +40,13 @@  discard block
 block discarded – undo
40 40
 
41 41
         $authUser = $this->findOrCreateUser($user, $provider);
42 42
 
43
-        $attempt = Auth::guard('web')->attempt(['email' => $authUser->email, 'password' => $authUser->provider_id]);
43
+        $attempt = Auth::guard('web')->attempt([ 'email' => $authUser->email, 'password' => $authUser->provider_id ]);
44 44
 
45 45
         $req = new Request([
46 46
             'email' => $authUser->email,
47 47
         ]);
48 48
 
49
-        if($attempt) {
49
+        if ($attempt) {
50 50
             $msg = "Selamat Datang ".$authUser->name." !";
51 51
             return redirect()->intended(route('home'))->with('info', $msg);
52 52
         }
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     private function findOrCreateUser($user, $provider)
66 66
     {
67 67
         $authUser = User::where('email', $user->getEmail())->first();
68
-        if($authUser) {
68
+        if ($authUser) {
69 69
             return $authUser;
70 70
         }
71 71
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
     private function sendFailedLoginResponse(Request $request)
85 85
     {
86 86
         throw ValidationException::withMessages([
87
-            'email' => [trans('auth.failed')],
87
+            'email' => [ trans('auth.failed') ],
88 88
         ]);
89 89
 
90 90
     }
Please login to merge, or discard this patch.
app/Http/Controllers/Auth/VerificationController.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\VerifiesEmails;
7 7
 
8
-class VerificationController extends Controller
9
-{
8
+class VerificationController extends Controller {
10 9
     /*
11 10
     |--------------------------------------------------------------------------
12 11
     | Email Verification Controller
Please login to merge, or discard this patch.
app/Http/Controllers/Auth/ForgotPasswordController.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\SendsPasswordResetEmails;
7 7
 
8
-class ForgotPasswordController extends Controller
9
-{
8
+class ForgotPasswordController extends Controller {
10 9
     /*
11 10
     |--------------------------------------------------------------------------
12 11
     | Password Reset Controller
Please login to merge, or discard this patch.
app/Http/Controllers/Auth/LoginController.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\AuthenticatesUsers;
7 7
 
8
-class LoginController extends Controller
9
-{
8
+class LoginController extends Controller {
10 9
     /*
11 10
     |--------------------------------------------------------------------------
12 11
     | Login Controller
Please login to merge, or discard this patch.
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
 
@@ -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.