Passed
Push — master ( 06bf02...b3147e )
by Ferry
03:01
created
src/types/select/Hook.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -19,9 +19,9 @@  discard block
 block discarded – undo
19 19
      */
20 20
     public function query($query, $column)
21 21
     {
22
-        if($column->getOptionsFromTable()) {
22
+        if ($column->getOptionsFromTable()) {
23 23
             $option = $column->getOptionsFromTable();
24
-            $query->join($option["table"],$option["table"].'.'.$option["key_field"],"=", $column->getName());
24
+            $query->join($option["table"], $option["table"].'.'.$option["key_field"], "=", $column->getName());
25 25
             $query->addSelect($option['table'].'.'.$option['display_field'].' as '.$option['table'].'_'.$option['display_field']);
26 26
         }
27 27
         return $query;
@@ -33,13 +33,13 @@  discard block
 block discarded – undo
33 33
      */
34 34
     public function indexRender($row, $column)
35 35
     {
36
-        if($column->getOptionsFromTable()) {
36
+        if ($column->getOptionsFromTable()) {
37 37
             $option = $column->getOptionsFromTable();
38 38
             return $row->{ $option['table'].'_'.$option['display_field'] };
39
-        }else{
39
+        } else {
40 40
             $option = $column->getOptions();
41 41
             $key = $row->{ $column->getField() };
42
-            return @$option[ $key ];
42
+            return @$option[$key];
43 43
         }
44 44
     }
45 45
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
         if($column->getOptionsFromTable()) {
37 37
             $option = $column->getOptionsFromTable();
38 38
             return $row->{ $option['table'].'_'.$option['display_field'] };
39
-        }else{
39
+        } else{
40 40
             $option = $column->getOptions();
41 41
             $key = $row->{ $column->getField() };
42 42
             return @$option[ $key ];
Please login to merge, or discard this patch.
src/database/migrations/2016_08_07_152421_table_menus.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
      */
13 13
     public function up()
14 14
     {
15
-        Schema::create('cb_menus', function (Blueprint $table) {
15
+        Schema::create('cb_menus', function(Blueprint $table) {
16 16
             $table->increments("id");
17 17
             $table->string('name');
18 18
             $table->string("icon")->nullable();
Please login to merge, or discard this patch.
src/types/checkbox/Checkbox.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 optionsFromTable($table, $key_field, $display_field, $SQLCondition = null) {
36 36
         $data = DB::table($table);
37
-        if($SQLCondition && is_callable($SQLCondition)) {
37
+        if ($SQLCondition && is_callable($SQLCondition)) {
38 38
             $data = call_user_func($SQLCondition, $data);
39 39
         }elseif ($SQLCondition && is_string($SQLCondition)) {
40 40
             $data->whereRaw($SQLCondition);
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
         $data = $data->get();
43 43
         $options = [];
44 44
         foreach ($data as $d) {
45
-            $options[ $d->$key_field ] = $d->$display_field;
45
+            $options[$d->$key_field] = $d->$display_field;
46 46
         }
47 47
         $this->options($options);
48 48
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
         $data = DB::table($table);
37 37
         if($SQLCondition && is_callable($SQLCondition)) {
38 38
             $data = call_user_func($SQLCondition, $data);
39
-        }elseif ($SQLCondition && is_string($SQLCondition)) {
39
+        } elseif ($SQLCondition && is_string($SQLCondition)) {
40 40
             $data->whereRaw($SQLCondition);
41 41
         }
42 42
         $data = $data->get();
Please login to merge, or discard this patch.
src/types/date/Hook.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@
 block discarded – undo
20 20
      */
21 21
     public function indexRender($row, $column)
22 22
     {
23
-        if($column->getFormat()) {
23
+        if ($column->getFormat()) {
24 24
             return date($column->getFormat(), strtotime($row->{$column->getField()}));
25
-        }else{
25
+        } else {
26 26
             return $row->{$column->getField()};
27 27
         }
28 28
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
     {
23 23
         if($column->getFormat()) {
24 24
             return date($column->getFormat(), strtotime($row->{$column->getField()}));
25
-        }else{
25
+        } else{
26 26
             return $row->{$column->getField()};
27 27
         }
28 28
     }
Please login to merge, or discard this patch.
src/helpers/UserSession.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php 
2 2
 namespace crocodicstudio\crudbooster\helpers;
3 3
 
4
-class UserSession  {
4
+class UserSession {
5 5
 
6 6
     public function user()
7 7
     {
@@ -21,14 +21,14 @@  discard block
 block discarded – undo
21 21
     public function photo()
22 22
     {
23 23
         $user = $this->user();
24
-        return ($user->photo)?asset($user->photo):asset(dummyPhoto());
24
+        return ($user->photo) ?asset($user->photo) : asset(dummyPhoto());
25 25
     }
26 26
 
27 27
     public function roleName()
28 28
     {
29 29
         $user = $this->user();
30 30
         $role = cb()->find("cb_roles", $user->cb_roles_id);
31
-        if($role) return $role->name;
31
+        if ($role) return $role->name;
32 32
         else return null;
33 33
     }
34 34
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,8 +28,11 @@
 block discarded – undo
28 28
     {
29 29
         $user = $this->user();
30 30
         $role = cb()->find("cb_roles", $user->cb_roles_id);
31
-        if($role) return $role->name;
32
-        else return null;
31
+        if($role) {
32
+            return $role->name;
33
+        } else {
34
+            return null;
35
+        }
33 36
     }
34 37
 
35 38
     public function roleId()
Please login to merge, or discard this patch.
src/helpers/SidebarMenus.php 2 patches
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     private function assignToModel($menu) {
23 23
         $model = new SidebarModel();
24 24
         $model->setId($menu->id);
25
-        if($menu->type == "url") {
25
+        if ($menu->type == "url") {
26 26
             $model->setUrl($menu->path);
27 27
             $model->setIcon($menu->icon);
28 28
             $model->setName($menu->name);
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
             $model->setBasepath(config('crudbooster.ADMIN_PATH').'/'.basename($model->getUrl()));
44 44
         }
45 45
 
46
-        if(request()->is($model->getBasepath()."*")) {
46
+        if (request()->is($model->getBasepath()."*")) {
47 47
             $model->setIsActive(true);
48
-        }else{
48
+        } else {
49 49
             $model->setIsActive(false);
50 50
         }
51 51
 
@@ -54,22 +54,22 @@  discard block
 block discarded – undo
54 54
 
55 55
     private function loadData($parent_id = null) {
56 56
         $menus = DB::table("cb_menus");
57
-        if($parent_id) {
58
-            $menus->where("parent_cb_menus_id",$parent_id);
59
-        }else{
57
+        if ($parent_id) {
58
+            $menus->where("parent_cb_menus_id", $parent_id);
59
+        } else {
60 60
             $menus->whereNull("parent_cb_menus_id");
61 61
         }
62
-        return $menus->orderBy("sort_number","asc")->get();
62
+        return $menus->orderBy("sort_number", "asc")->get();
63 63
     }
64 64
 
65 65
     private function rolePrivilege($cb_roles_id, $cb_menus_id) {
66
-        return cb()->find("cb_role_privileges",['cb_roles_id'=>$cb_roles_id,'cb_menus_id'=>$cb_menus_id]);
66
+        return cb()->find("cb_role_privileges", ['cb_roles_id'=>$cb_roles_id, 'cb_menus_id'=>$cb_menus_id]);
67 67
     }
68 68
 
69
-    private function checkPrivilege($roles_id,$menu) {
70
-        if($roles_id) {
69
+    private function checkPrivilege($roles_id, $menu) {
70
+        if ($roles_id) {
71 71
             $privilege = $this->rolePrivilege($roles_id, $menu->id);
72
-            if($privilege && !$privilege->can_browse) {
72
+            if ($privilege && !$privilege->can_browse) {
73 73
                 return false;
74 74
             }
75 75
         }
@@ -78,36 +78,36 @@  discard block
 block discarded – undo
78 78
     }
79 79
 
80 80
     public function all($withPrivilege = true) {
81
-        $roles_id = ($withPrivilege)?cb()->session()->roleId():null;
81
+        $roles_id = ($withPrivilege) ?cb()->session()->roleId() : null;
82 82
         $menus = $this->loadData();
83 83
         $result = [];
84 84
         $menus_active = false;
85
-        foreach($menus as $menu) {
85
+        foreach ($menus as $menu) {
86 86
 
87
-            if($withPrivilege && !$this->checkPrivilege($roles_id, $menu)) continue;
87
+            if ($withPrivilege && !$this->checkPrivilege($roles_id, $menu)) continue;
88 88
 
89 89
             $sidebarModel = $this->assignToModel($menu);
90
-            if($sidebarModel->getisActive()) $menus_active = true;
91
-            if($menus2 = $this->loadData($menu->id)) {
90
+            if ($sidebarModel->getisActive()) $menus_active = true;
91
+            if ($menus2 = $this->loadData($menu->id)) {
92 92
                 $sub1 = [];
93 93
                 $menus2_active = false;
94 94
                 foreach ($menus2 as $menu2) {
95 95
 
96
-                    if($withPrivilege && !$this->checkPrivilege($roles_id, $menu2)) continue;
96
+                    if ($withPrivilege && !$this->checkPrivilege($roles_id, $menu2)) continue;
97 97
 
98 98
                     $sidebarModel2 = $this->assignToModel($menu2);
99
-                    if($sidebarModel2->getisActive()) $menus2_active = true;
99
+                    if ($sidebarModel2->getisActive()) $menus2_active = true;
100 100
 
101
-                    if($menus3 = $this->loadData($menu2->id)) {
101
+                    if ($menus3 = $this->loadData($menu2->id)) {
102 102
                         $sub2 = [];
103 103
                         $menus3_active = false;
104 104
                         foreach ($menus3 as $menu3) {
105 105
 
106
-                            if($withPrivilege && !$this->checkPrivilege($roles_id, $menu3)) continue;
106
+                            if ($withPrivilege && !$this->checkPrivilege($roles_id, $menu3)) continue;
107 107
 
108 108
                             $sidebarModel3 = $this->assignToModel($menu3);
109 109
 
110
-                            if($sidebarModel3->getisActive()) {
110
+                            if ($sidebarModel3->getisActive()) {
111 111
                                 $menus3_active = true;
112 112
                             }
113 113
 
Please login to merge, or discard this patch.
Braces   +19 added lines, -9 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
             $model->setIcon($menu->icon);
28 28
             $model->setName($menu->name);
29 29
             $model->setBasepath(basename($model->getUrl()));
30
-        }elseif ($menu->type == "module") {
30
+        } elseif ($menu->type == "module") {
31 31
             $module = cb()->find("cb_modules", $menu->cb_modules_id);
32 32
             $className = '\App\Http\Controllers\\'.$module->controller;
33 33
             $controllerClass = new $className();
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
             $model->setIcon($module->icon);
37 37
             $model->setName($module->name);
38 38
             $model->setBasepath(config('crudbooster.ADMIN_PATH').'/'.basename($model->getUrl()));
39
-        }elseif ($menu->type == "path") {
39
+        } elseif ($menu->type == "path") {
40 40
             $model->setUrl(cb()->getAdminUrl($menu->path));
41 41
             $model->setIcon($menu->icon);
42 42
             $model->setName($menu->name);
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
         if(request()->is($model->getBasepath()."*")) {
47 47
             $model->setIsActive(true);
48
-        }else{
48
+        } else{
49 49
             $model->setIsActive(false);
50 50
         }
51 51
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         $menus = DB::table("cb_menus");
57 57
         if($parent_id) {
58 58
             $menus->where("parent_cb_menus_id",$parent_id);
59
-        }else{
59
+        } else{
60 60
             $menus->whereNull("parent_cb_menus_id");
61 61
         }
62 62
         return $menus->orderBy("sort_number","asc")->get();
@@ -84,26 +84,36 @@  discard block
 block discarded – undo
84 84
         $menus_active = false;
85 85
         foreach($menus as $menu) {
86 86
 
87
-            if($withPrivilege && !$this->checkPrivilege($roles_id, $menu)) continue;
87
+            if($withPrivilege && !$this->checkPrivilege($roles_id, $menu)) {
88
+                continue;
89
+            }
88 90
 
89 91
             $sidebarModel = $this->assignToModel($menu);
90
-            if($sidebarModel->getisActive()) $menus_active = true;
92
+            if($sidebarModel->getisActive()) {
93
+                $menus_active = true;
94
+            }
91 95
             if($menus2 = $this->loadData($menu->id)) {
92 96
                 $sub1 = [];
93 97
                 $menus2_active = false;
94 98
                 foreach ($menus2 as $menu2) {
95 99
 
96
-                    if($withPrivilege && !$this->checkPrivilege($roles_id, $menu2)) continue;
100
+                    if($withPrivilege && !$this->checkPrivilege($roles_id, $menu2)) {
101
+                        continue;
102
+                    }
97 103
 
98 104
                     $sidebarModel2 = $this->assignToModel($menu2);
99
-                    if($sidebarModel2->getisActive()) $menus2_active = true;
105
+                    if($sidebarModel2->getisActive()) {
106
+                        $menus2_active = true;
107
+                    }
100 108
 
101 109
                     if($menus3 = $this->loadData($menu2->id)) {
102 110
                         $sub2 = [];
103 111
                         $menus3_active = false;
104 112
                         foreach ($menus3 as $menu3) {
105 113
 
106
-                            if($withPrivilege && !$this->checkPrivilege($roles_id, $menu3)) continue;
114
+                            if($withPrivilege && !$this->checkPrivilege($roles_id, $menu3)) {
115
+                                continue;
116
+                            }
107 117
 
108 118
                             $sidebarModel3 = $this->assignToModel($menu3);
109 119
 
Please login to merge, or discard this patch.
src/controllers/traits/ControllerSetting.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
         $this->setButtonDetail(true);
30 30
         $this->setButtonSave(true);
31 31
         $this->setButtonLimitPage(true);
32
-        $this->hideButtonDeleteWhen(function ($row) { return false; });
33
-        $this->hideButtonDetailWhen(function ($row) { return false; });
34
-        $this->hideButtonEditWhen(function ($row) { return false; });
32
+        $this->hideButtonDeleteWhen(function($row) { return false; });
33
+        $this->hideButtonDetailWhen(function($row) { return false; });
34
+        $this->hideButtonEditWhen(function($row) { return false; });
35 35
     }
36 36
 
37 37
 
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
      * @param ButtonColor $color
129 129
      * @param string $attributes
130 130
      */
131
-    public function addIndexActionButton($label, $actionURL, $fontAwesome_icon=null, $color=null, $attributes = null)
131
+    public function addIndexActionButton($label, $actionURL, $fontAwesome_icon = null, $color = null, $attributes = null)
132 132
     {
133
-        $color = ($color)?:ButtonColor::DARK_BLUE;
133
+        $color = ($color) ?: ButtonColor::DARK_BLUE;
134 134
 
135 135
         $model = new IndexActionButtonModel();
136 136
         $model->setLabel($label);
@@ -185,12 +185,12 @@  discard block
 block discarded – undo
185 185
      * @param $fontAwesome_icon
186 186
      * @param ButtonColor|string $color
187 187
      */
188
-    public function addActionButton($label, $url_target, $condition_callback=null, $fontAwesome_icon=null, $color=null, $confirmation = false)
188
+    public function addActionButton($label, $url_target, $condition_callback = null, $fontAwesome_icon = null, $color = null, $confirmation = false)
189 189
     {
190 190
         $new = new AddActionButtonModel();
191 191
         $new->setLabel($label);
192
-        $new->setIcon($fontAwesome_icon?:"fa fa-bars");
193
-        $new->setColor($color?:"primary");
192
+        $new->setIcon($fontAwesome_icon ?: "fa fa-bars");
193
+        $new->setColor($color ?: "primary");
194 194
         $new->setUrl($url_target);
195 195
         $new->setCondition($condition_callback);
196 196
         $new->setConfirmation($confirmation);
Please login to merge, or discard this patch.
src/types/image/Hook.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
     public function detailRender($row, $column)
29 29
     {
30 30
         $column->setValue($row->{ $column->getField() });
31
-        return view("types::image.detail",[
31
+        return view("types::image.detail", [
32 32
             'row'=>$row,
33 33
             'column'=>$column
34 34
         ]);
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     public function indexRender($row, $column)
38 38
     {
39 39
         $column->setValue($row->{ $column->getField() });
40
-        return view("types::image.index",[
40
+        return view("types::image.index", [
41 41
             'row'=>$row,
42 42
             'column'=>$column
43 43
         ]);
Please login to merge, or discard this patch.
src/types/file/Hook.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
     public function detailRender($row, $column)
28 28
     {
29 29
         $column->setValue($row->{ $column->getField() });
30
-        return view("types::file.detail",[
30
+        return view("types::file.detail", [
31 31
             'row'=>$row,
32 32
             'column'=>$column
33 33
         ]);
Please login to merge, or discard this patch.