Passed
Push — master ( f7976d...1a53ec )
by John
04:45 queued 11s
created
app/Models/ProblemModel.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
 
179 179
     private function inteliAudit($uid, $content)
180 180
     {
181
-        if (strpos($content, '```')!==false){
181
+        if (strpos($content, '```')!==false) {
182 182
             $userSolutionHistory=DB::table("problem_solution")->where(['uid'=>$uid])->orderByDesc('updated_at')->first();
183
-            if (!empty($userSolutionHistory) && $userSolutionHistory["audit"]==1){
183
+            if (!empty($userSolutionHistory) && $userSolutionHistory["audit"]==1) {
184 184
                 return 1;
185 185
             }
186 186
         }
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
     {
277 277
         // $prob_list = DB::table($this->table)->select("pid","pcode","title")->get()->all(); // return a array
278 278
         $submissionModel=new SubmissionModel();
279
-        $preQuery=DB::table($this->table)->where('hide','=',0);
279
+        $preQuery=DB::table($this->table)->where('hide', '=', 0);
280 280
         if ($filter['oj']) {
281 281
             $preQuery=$preQuery->where(["OJ"=>$filter['oj']]);
282 282
         }
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
 
431 431
         if (!empty($data["sample"])) {
432 432
             foreach ($data["sample"] as $d) {
433
-                if(!isset($d['sample_note'])) $d['sample_note']=null;
433
+                if (!isset($d['sample_note'])) $d['sample_note']=null;
434 434
                 DB::table("problem_sample")->insert([
435 435
                     'pid'=>$pid,
436 436
                     'sample_input'=>$d['sample_input'],
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 
477 477
         if (!empty($data["sample"])) {
478 478
             foreach ($data["sample"] as $d) {
479
-                if(!isset($d['sample_note'])) $d['sample_note']=null;
479
+                if (!isset($d['sample_note'])) $d['sample_note']=null;
480 480
                 DB::table("problem_sample")->insert([
481 481
                     'pid'=>$pid,
482 482
                     'sample_input'=>$d['sample_input'],
@@ -491,6 +491,6 @@  discard block
 block discarded – undo
491 491
 
492 492
     public function isHidden($pid)
493 493
     {
494
-        return DB::table('problem')->where('pid','=',$pid)->get()->first()['hide'];
494
+        return DB::table('problem')->where('pid', '=', $pid)->get()->first()['hide'];
495 495
     }
496 496
 }
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.