Passed
Pull Request — master (#266)
by John
05:30
created
app/Http/Controllers/Contest/BoardController.php 2 patches
Braces   +12 added lines, -10 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
         if (!$clearance || time() < strtotime($basicInfo['begin_time'])) {
38 38
             if($clearance == 3){
39 39
                 return Redirect::route('contest.admin', ['cid' => $cid]);
40
-            }else{
40
+            } else{
41 41
                 return Redirect::route('contest.detail', ['cid' => $cid]);
42 42
             }
43 43
         }
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
         if (!$clearance || time() < strtotime($basicInfo['begin_time'])) {
84 84
             if($clearance == 3){
85 85
                 return Redirect::route('contest.admin', ['cid' => $cid]);
86
-            }else{
86
+            } else{
87 87
                 return Redirect::route('contest.detail', ['cid' => $cid]);
88 88
             }
89 89
         }
@@ -116,7 +116,9 @@  discard block
 block discarded – undo
116 116
         }
117 117
 
118 118
         $editor_left_width = $accountModel->getExtra(Auth::user()->id, 'editor_left_width');
119
-        if(empty($editor_left_width)) $editor_left_width='40';
119
+        if(empty($editor_left_width)) {
120
+            $editor_left_width='40';
121
+        }
120 122
 
121 123
         return view('contest.board.editor', [
122 124
             'page_title'=>"Problem Detail",
@@ -153,7 +155,7 @@  discard block
 block discarded – undo
153 155
         if (!$clearance || time() < strtotime($basicInfo['begin_time'])) {
154 156
             if($clearance == 3){
155 157
                 return Redirect::route('contest.admin', ['cid' => $cid]);
156
-            }else{
158
+            } else{
157 159
                 return Redirect::route('contest.detail', ['cid' => $cid]);
158 160
             }
159 161
         }
@@ -168,10 +170,10 @@  discard block
 block discarded – undo
168 170
             if($i != 0) {
169 171
                 if($r['score'] == $contestRank[$i-1]['score'] && $r['penalty'] == $contestRank[$i-1]['penalty']){
170 172
                     $r['rank'] = $contestRank[$i-1]['rank'];
171
-                }else{
173
+                } else{
172 174
                     $r['rank'] = $i + 1;
173 175
                 }
174
-            }else{
176
+            } else{
175 177
                 $r['rank'] = 1;
176 178
             }
177 179
         }
@@ -212,7 +214,7 @@  discard block
 block discarded – undo
212 214
         if (!$clearance || time() < strtotime($basicInfo['begin_time'])) {
213 215
             if($clearance == 3){
214 216
                 return Redirect::route('contest.admin', ['cid' => $cid]);
215
-            }else{
217
+            } else{
216 218
                 return Redirect::route('contest.detail', ['cid' => $cid]);
217 219
             }
218 220
         }
@@ -250,7 +252,7 @@  discard block
 block discarded – undo
250 252
         if (!$clearance || time() < strtotime($basicInfo['begin_time'])) {
251 253
             if($clearance == 3){
252 254
                 return Redirect::route('contest.admin', ['cid' => $cid]);
253
-            }else{
255
+            } else{
254 256
                 return Redirect::route('contest.detail', ['cid' => $cid]);
255 257
             }
256 258
         }
@@ -285,7 +287,7 @@  discard block
 block discarded – undo
285 287
         if (!$clearance || time() < strtotime($basicInfo['begin_time'])) {
286 288
             if($clearance == 3){
287 289
                 return Redirect::route('contest.admin', ['cid' => $cid]);
288
-            }else{
290
+            } else{
289 291
                 return Redirect::route('contest.detail', ['cid' => $cid]);
290 292
             }
291 293
         }
@@ -310,7 +312,7 @@  discard block
 block discarded – undo
310 312
         if (!$clearance || time() < strtotime($basicInfo['begin_time'])) {
311 313
             if($clearance == 3){
312 314
                 return Redirect::route('contest.admin', ['cid' => $cid]);
313
-            }else{
315
+            } else{
314 316
                 return Redirect::route('contest.detail', ['cid' => $cid]);
315 317
             }
316 318
         }
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -34,10 +34,10 @@  discard block
 block discarded – undo
34 34
         $contestModel=new ContestModel();
35 35
         $clearance=$contestModel->judgeClearance($cid, Auth::user()->id);
36 36
         $basicInfo=$contestModel->basic($cid);
37
-        if (!$clearance || time() < strtotime($basicInfo['begin_time'])) {
38
-            if($clearance == 3){
37
+        if (!$clearance || time()<strtotime($basicInfo['begin_time'])) {
38
+            if ($clearance==3) {
39 39
                 return Redirect::route('contest.admin', ['cid' => $cid]);
40
-            }else{
40
+            } else {
41 41
                 return Redirect::route('contest.detail', ['cid' => $cid]);
42 42
             }
43 43
         }
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         if ($remainingTime<=0) {
51 51
             $remainingTime=0;
52 52
         }
53
-        if($basicInfo['public'] && !$basicInfo['audit_status']){
53
+        if ($basicInfo['public'] && !$basicInfo['audit_status']) {
54 54
             return Redirect::route('contest.detail', ['cid' => $cid]);
55 55
         }
56 56
         return view('contest.board.challenge', [
@@ -83,15 +83,15 @@  discard block
 block discarded – undo
83 83
         $accountModel=new AccountModel();
84 84
         $clearance=$contestModel->judgeClearance($cid, Auth::user()->id);
85 85
         $basicInfo=$contestModel->basic($cid);
86
-        if (!$clearance || time() < strtotime($basicInfo['begin_time'])) {
87
-            if($clearance == 3){
86
+        if (!$clearance || time()<strtotime($basicInfo['begin_time'])) {
87
+            if ($clearance==3) {
88 88
                 return Redirect::route('contest.admin', ['cid' => $cid]);
89
-            }else{
89
+            } else {
90 90
                 return Redirect::route('contest.detail', ['cid' => $cid]);
91 91
             }
92 92
         }
93 93
         $basicInfo=$contestModel->basic($cid);
94
-        if($basicInfo['public'] && !$basicInfo['audit_status']){
94
+        if ($basicInfo['public'] && !$basicInfo['audit_status']) {
95 95
             return Redirect::route('contest.detail', ['cid' => $cid]);
96 96
         }
97 97
         $contest_name=$contestModel->contestName($cid);
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
             ];
123 123
         }
124 124
 
125
-        $editor_left_width = $accountModel->getExtra(Auth::user()->id, 'editor_left_width');
126
-        if(empty($editor_left_width)) $editor_left_width='40';
125
+        $editor_left_width=$accountModel->getExtra(Auth::user()->id, 'editor_left_width');
126
+        if (empty($editor_left_width)) $editor_left_width='40';
127 127
 
128 128
         return view('contest.board.editor', [
129 129
             'page_title'=>"Problem Detail",
@@ -157,15 +157,15 @@  discard block
 block discarded – undo
157 157
         $contestModel=new ContestModel();
158 158
         $clearance=$contestModel->judgeClearance($cid, Auth::user()->id);
159 159
         $basicInfo=$contestModel->basic($cid);
160
-        if (!$clearance || time() < strtotime($basicInfo['begin_time'])) {
161
-            if($clearance == 3){
160
+        if (!$clearance || time()<strtotime($basicInfo['begin_time'])) {
161
+            if ($clearance==3) {
162 162
                 return Redirect::route('contest.admin', ['cid' => $cid]);
163
-            }else{
163
+            } else {
164 164
                 return Redirect::route('contest.detail', ['cid' => $cid]);
165 165
             }
166 166
         }
167 167
         $basicInfo=$contestModel->basic($cid);
168
-        if($basicInfo['public'] && !$basicInfo['audit_status']){
168
+        if ($basicInfo['public'] && !$basicInfo['audit_status']) {
169 169
             return Redirect::route('contest.detail', ['cid' => $cid]);
170 170
         }
171 171
         $contest_name=$contestModel->contestName($cid);
@@ -176,14 +176,14 @@  discard block
 block discarded – undo
176 176
 
177 177
         // To determine the ranking
178 178
         foreach ($contestRank as $i => &$r) {
179
-            if($i != 0) {
180
-                if($r['score'] == $contestRank[$i-1]['score'] && $r['penalty'] == $contestRank[$i-1]['penalty']){
181
-                    $r['rank'] = $contestRank[$i-1]['rank'];
182
-                }else{
183
-                    $r['rank'] = $i + 1;
179
+            if ($i!=0) {
180
+                if ($r['score']==$contestRank[$i-1]['score'] && $r['penalty']==$contestRank[$i-1]['penalty']) {
181
+                    $r['rank']=$contestRank[$i-1]['rank'];
182
+                } else {
183
+                    $r['rank']=$i+1;
184 184
                 }
185
-            }else{
186
-                $r['rank'] = 1;
185
+            } else {
186
+                $r['rank']=1;
187 187
             }
188 188
         }
189 189
         $rankFrozen=$contestModel->isFrozen($cid);
@@ -220,15 +220,15 @@  discard block
 block discarded – undo
220 220
         $contestModel=new ContestModel();
221 221
         $clearance=$contestModel->judgeClearance($cid, Auth::user()->id);
222 222
         $basicInfo=$contestModel->basic($cid);
223
-        if (!$clearance || time() < strtotime($basicInfo['begin_time'])) {
224
-            if($clearance == 3){
223
+        if (!$clearance || time()<strtotime($basicInfo['begin_time'])) {
224
+            if ($clearance==3) {
225 225
                 return Redirect::route('contest.admin', ['cid' => $cid]);
226
-            }else{
226
+            } else {
227 227
                 return Redirect::route('contest.detail', ['cid' => $cid]);
228 228
             }
229 229
         }
230 230
         $basicInfo=$contestModel->basic($cid);
231
-        if($basicInfo['public'] && !$basicInfo['audit_status']){
231
+        if ($basicInfo['public'] && !$basicInfo['audit_status']) {
232 232
             return Redirect::route('contest.detail', ['cid' => $cid]);
233 233
         }
234 234
         $contest_name=$contestModel->contestName($cid);
@@ -262,14 +262,14 @@  discard block
 block discarded – undo
262 262
         $contestModel=new ContestModel();
263 263
         $clearance=$contestModel->judgeClearance($cid, Auth::user()->id);
264 264
         $basicInfo=$contestModel->basic($cid);
265
-        if (!$clearance || time() < strtotime($basicInfo['begin_time'])) {
266
-            if($clearance == 3){
265
+        if (!$clearance || time()<strtotime($basicInfo['begin_time'])) {
266
+            if ($clearance==3) {
267 267
                 return Redirect::route('contest.admin', ['cid' => $cid]);
268
-            }else{
268
+            } else {
269 269
                 return Redirect::route('contest.detail', ['cid' => $cid]);
270 270
             }
271 271
         }
272
-        if($basicInfo['public'] && !$basicInfo['audit_status']){
272
+        if ($basicInfo['public'] && !$basicInfo['audit_status']) {
273 273
             return Redirect::route('contest.detail', ['cid' => $cid]);
274 274
         }
275 275
         $contest_name=$contestModel->contestName($cid);
@@ -300,14 +300,14 @@  discard block
 block discarded – undo
300 300
         $contestModel=new ContestModel();
301 301
         $clearance=$contestModel->judgeClearance($cid, Auth::user()->id);
302 302
         $basicInfo=$contestModel->basic($cid);
303
-        if (!$clearance || time() < strtotime($basicInfo['begin_time'])) {
304
-            if($clearance == 3){
303
+        if (!$clearance || time()<strtotime($basicInfo['begin_time'])) {
304
+            if ($clearance==3) {
305 305
                 return Redirect::route('contest.admin', ['cid' => $cid]);
306
-            }else{
306
+            } else {
307 307
                 return Redirect::route('contest.detail', ['cid' => $cid]);
308 308
             }
309 309
         }
310
-        if($basicInfo['public'] && !$basicInfo['audit_status']){
310
+        if ($basicInfo['public'] && !$basicInfo['audit_status']) {
311 311
             return Redirect::route('contest.detail', ['cid' => $cid]);
312 312
         }
313 313
         $contest_name=$contestModel->contestName($cid);
@@ -324,19 +324,19 @@  discard block
 block discarded – undo
324 324
         ]);
325 325
     }
326 326
 
327
-    public function analysis($cid){
327
+    public function analysis($cid) {
328 328
         $contestModel=new ContestModel();
329 329
         $clearance=$contestModel->judgeClearance($cid, Auth::user()->id);
330 330
         $basicInfo=$contestModel->basic($cid);
331
-        if (!$clearance || time() < strtotime($basicInfo['begin_time'])) {
332
-            if($clearance == 3){
331
+        if (!$clearance || time()<strtotime($basicInfo['begin_time'])) {
332
+            if ($clearance==3) {
333 333
                 return Redirect::route('contest.admin', ['cid' => $cid]);
334
-            }else{
334
+            } else {
335 335
                 return Redirect::route('contest.detail', ['cid' => $cid]);
336 336
             }
337 337
         }
338 338
         $basicInfo=$contestModel->basic($cid);
339
-        if($basicInfo['public'] && !$basicInfo['audit_status']){
339
+        if ($basicInfo['public'] && !$basicInfo['audit_status']) {
340 340
             return Redirect::route('contest.detail', ['cid' => $cid]);
341 341
         }
342 342
         $contest_name=$contestModel->contestName($cid);
Please login to merge, or discard this patch.
app/Http/Controllers/Contest/IndexController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
         $filter["rated"]=isset($all_data["rated"]) ? $all_data["rated"] : null;
28 28
         $filter["anticheated"]=isset($all_data["anticheated"]) ? $all_data["anticheated"] : null;
29 29
         $filter["practice"]=isset($all_data["practice"]) ? $all_data["practice"] : null;
30
-        $return_list=$contestModel->list($filter,Auth::check()?Auth::user()->id:0);
30
+        $return_list=$contestModel->list($filter, Auth::check() ?Auth::user()->id : 0);
31 31
         $featured=$contestModel->featured();
32 32
         if (is_null($return_list)) {
33 33
             if (isset($all_data["page"]) && $all_data["page"]>1) {
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         $contestModel=new ContestModel();
67 67
         $groupModel=new GroupModel();
68 68
         $clearance=Auth::check() ? $contestModel->judgeClearance($cid, Auth::user()->id) : 0;
69
-        $basic = $contestModel->basic($cid);
69
+        $basic=$contestModel->basic($cid);
70 70
         if (Auth::check()) {
71 71
             $contest_detail=$contestModel->detail($cid, Auth::user()->id);
72 72
             $registration=$contestModel->registration($cid, Auth::user()->id);
Please login to merge, or discard this patch.
app/Babel/Extension/noj/Submitter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@
 block discarded – undo
76 76
             "spj_version" => null,
77 77
             "spj_config" => null
78 78
         ];
79
-        if($probBasic["spj"] && $probBasic["spj_version"]){
79
+        if ($probBasic["spj"] && $probBasic["spj_version"]) {
80 80
             $submit_data["spj_version"]=$probBasic["spj_version"];
81 81
             $submit_data["spj_config"]=$probBasic["spj_lang"];
82 82
         }
Please login to merge, or discard this patch.
app/Babel/Extension/noj/JudgeClient.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
     }
65 65
     public function getLanguageConfigByLanguage($language, $spj=false)
66 66
     {
67
-        return $this->getLanguageConfigByKey($language.($spj?'_lang_spj_config':'_lang_config'));
67
+        return $this->getLanguageConfigByKey($language.($spj ? '_lang_spj_config' : '_lang_config'));
68 68
     }
69 69
     public function getLanguageConfigByKey($key)
70 70
     {
Please login to merge, or discard this patch.
app/Models/Search/ProblemSearchModel.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -13,20 +13,20 @@
 block discarded – undo
13 13
 
14 14
     public function search($key)
15 15
     {
16
-        $result = [];
17
-        if(strlen($key) >= 2){
18
-            $ret = self::where('pcode', $key)
19
-                ->orWhereRaw('MATCH(`title`) AGAINST (? IN BOOLEAN MODE)',[$key])
16
+        $result=[];
17
+        if (strlen($key)>=2) {
18
+            $ret=self::where('pcode', $key)
19
+                ->orWhereRaw('MATCH(`title`) AGAINST (? IN BOOLEAN MODE)', [$key])
20 20
                 ->select('pcode', 'title')
21 21
                 ->limit(120)
22 22
                 ->get()->all();
23
-            if(!empty($ret)){
24
-                $result += $ret;
23
+            if (!empty($ret)) {
24
+                $result+=$ret;
25 25
             }
26 26
         }
27
-        $problemModel = new ProblemModel();
27
+        $problemModel=new ProblemModel();
28 28
         foreach ($result as $p_index => $p) {
29
-            if($problemModel->isBlocked($p['pid']) || $problemModel->isHidden($p["pid"])){
29
+            if ($problemModel->isBlocked($p['pid']) || $problemModel->isHidden($p["pid"])) {
30 30
                 unset($result[$p_index]);
31 31
             }
32 32
         }
Please login to merge, or discard this patch.
app/Admin/Controllers/SubmissionController.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -83,11 +83,11 @@  discard block
 block discarded – undo
83 83
         $grid->column('sid', "ID")->sortable();
84 84
         $grid->time("Time");
85 85
         $grid->memory("Memory");
86
-        $grid->verdict("Verdict")->display(function ($verdict) {
86
+        $grid->verdict("Verdict")->display(function($verdict) {
87 87
             return '<i class="fa fa-circle '.$this->color.'"></i> '.$verdict;
88 88
         });
89 89
         $grid->language("Language");
90
-        $grid->submission_date("Submission Date")->display(function ($submission_date) {
90
+        $grid->submission_date("Submission Date")->display(function($submission_date) {
91 91
             return date("Y-m-d H:i:s", $submission_date);
92 92
         });
93 93
         ;
@@ -97,11 +97,11 @@  discard block
 block discarded – undo
97 97
         $grid->jid("JID");
98 98
         $grid->coid("COID");
99 99
         $grid->score("Raw Score");
100
-        $grid->filter(function (Grid\Filter $filter) {
101
-            $filter->column(6, function ($filter) {
100
+        $grid->filter(function(Grid\Filter $filter) {
101
+            $filter->column(6, function($filter) {
102 102
                 $filter->like('verdict');
103 103
             });
104
-            $filter->column(6, function ($filter) {
104
+            $filter->column(6, function($filter) {
105 105
                 $filter->equal('cid', 'Contest ID');
106 106
                 $filter->equal('uid', 'User ID');
107 107
                 $filter->equal('pid', 'Problem ID');
@@ -138,14 +138,14 @@  discard block
 block discarded – undo
138 138
         $show->coid('COID');
139 139
         $show->vcid('VCID');
140 140
         $show->score();
141
-        $show->share()->using(['No','Yes']);
141
+        $show->share()->using(['No', 'Yes']);
142 142
         return $show;
143 143
     }
144 144
 
145 145
     private function codify($field, $lang=null)
146 146
     {
147
-        $field->unescape()->as(function ($value) use ($field,$lang) {
148
-            $field->border = false;
147
+        $field->unescape()->as(function($value) use ($field, $lang) {
148
+            $field->border=false;
149 149
             $hash=md5($value);
150 150
             if (blank($value)) {
151 151
                 $value=" ";
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
     {
187 187
         $form=new Form(new EloquentSubmissionModel);
188 188
         $form->model()->makeVisible('password');
189
-        $form->tab('Basic', function (Form $form) {
189
+        $form->tab('Basic', function(Form $form) {
190 190
             $form->display('sid');
191 191
             $form->text('time')->rules('required');
192 192
             $form->text('memory')->rules('required');
Please login to merge, or discard this patch.
app/Admin/Controllers/BabelController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
     {
91 91
         $extensionList=ExtensionModel::list();
92 92
 
93
-        if(empty($extensionList)){
93
+        if (empty($extensionList)) {
94 94
             return view('admin::babel.empty');
95 95
         }
96 96
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
     {
104 104
         $details=ExtensionModel::remoteDetail($code);
105 105
 
106
-        if(empty($details)){
106
+        if (empty($details)) {
107 107
             return view('admin::babel.empty');
108 108
         }
109 109
 
@@ -116,8 +116,8 @@  discard block
 block discarded – undo
116 116
     {
117 117
         header("Connection: Keep-alive");
118 118
 
119
-        $fp = popen('"'.PHP_BINARY.'" "'.base_path('artisan').'" '.$command, "r");
120
-        while($b = fgets($fp, 2048)) {
119
+        $fp=popen('"'.PHP_BINARY.'" "'.base_path('artisan').'" '.$command, "r");
120
+        while ($b=fgets($fp, 2048)) {
121 121
             echo $b."<br>";
122 122
             flush();
123 123
         }
Please login to merge, or discard this patch.
app/Admin/routes.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
     $router->resource('contests', ContestController::class);
18 18
     $router->resource('groups', GroupController::class);
19 19
 
20
-    Route::group(['prefix' => 'babel'], function (Router $router) {
20
+    Route::group(['prefix' => 'babel'], function(Router $router) {
21 21
         $router->get('/', 'BabelController@index')->name('admin.babel.index');
22 22
         $router->get('installed', 'BabelController@installed')->name('admin.babel.installed');
23 23
         $router->get('marketspace', 'BabelController@marketspace')->name('admin.babel.marketspace');
Please login to merge, or discard this patch.
app/Models/Eloquent/MessageModel.php 2 patches
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -17,11 +17,11 @@  discard block
 block discarded – undo
17 17
      */
18 18
     public static function send($config)
19 19
     {
20
-        $message = new MessageModel;
21
-        $message->sender = $config['sender'];
22
-        $message->receiver = $config['receiver'];
23
-        $message->title = $config['title'];
24
-        $message->content = $config['content'];
20
+        $message=new MessageModel;
21
+        $message->sender=$config['sender'];
22
+        $message->receiver=$config['receiver'];
23
+        $message->title=$config['title'];
24
+        $message->content=$config['content'];
25 25
         /*
26 26
         if(isset($config['reply'])){
27 27
             $message->reply = $config['reply'];
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
             $message->reply = $config['allow_reply'];
31 31
         }
32 32
         */
33
-        $message->official = 1;
33
+        $message->official=1;
34 34
         $message->save();
35 35
         return true;
36 36
     }
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
      */
62 62
     public static function allowReply($id)
63 63
     {
64
-        $message = static::where('id',$id)->first();
65
-        if(empty($message)){
64
+        $message=static::where('id', $id)->first();
65
+        if (empty($message)) {
66 66
             return false;
67 67
         }
68 68
         return $message['allow_reply'] ? true : false;
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
      */
78 78
     public static function list($uid)
79 79
     {
80
-        return static::join('users','message.sender','=','users.id')
81
-            ->where('receiver',$uid)
80
+        return static::join('users', 'message.sender', '=', 'users.id')
81
+            ->where('receiver', $uid)
82 82
             ->select(
83 83
                 'message.id as id',
84 84
                 'users.name as sender_name',
@@ -103,13 +103,13 @@  discard block
 block discarded – undo
103 103
      */
104 104
     public static function read($mid)
105 105
     {
106
-        $message = static::find($mid);
107
-        if(!empty($message)){
108
-            $message->unread = 0;
106
+        $message=static::find($mid);
107
+        if (!empty($message)) {
108
+            $message->unread=0;
109 109
             $message->save();
110 110
         }
111
-        return static::join('users','message.sender','=','users.id')
112
-            ->where('message.id',$mid)
111
+        return static::join('users', 'message.sender', '=', 'users.id')
112
+            ->where('message.id', $mid)
113 113
             ->select(
114 114
                 'message.id as id',
115 115
                 'users.name as sender_name',
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
      */
134 134
     public static function allRead($uid)
135 135
     {
136
-        return static::where('receiver',$uid)
136
+        return static::where('receiver', $uid)
137 137
             ->update(['unread' => 0]);
138 138
     }
139 139
 
@@ -161,20 +161,20 @@  discard block
 block discarded – undo
161 161
      */
162 162
     public static function remove($messages)
163 163
     {
164
-        $del_count = 0;
165
-        if(is_array($messages)){
164
+        $del_count=0;
165
+        if (is_array($messages)) {
166 166
             foreach ($messages as $mid) {
167
-                $message = static::find($mid);
168
-                if(!empty($message)){
167
+                $message=static::find($mid);
168
+                if (!empty($message)) {
169 169
                     $message->delete();
170
-                    $del_count ++;
170
+                    $del_count++;
171 171
                 }
172 172
             }
173
-        }else{
174
-            $message = static::find($messages);
175
-            if(!empty($message)){
173
+        } else {
174
+            $message=static::find($messages);
175
+            if (!empty($message)) {
176 176
                 $message->delete();
177
-                $del_count ++;
177
+                $del_count++;
178 178
             }
179 179
         }
180 180
         return $del_count;
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -170,7 +170,7 @@
 block discarded – undo
170 170
                     $del_count ++;
171 171
                 }
172 172
             }
173
-        }else{
173
+        } else{
174 174
             $message = static::find($messages);
175 175
             if(!empty($message)){
176 176
                 $message->delete();
Please login to merge, or discard this patch.