Passed
Push — master ( 3c2be5...ef5ef1 )
by Ferry
03:56
created
src/controllers/AdminAuthController.php 2 patches
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,7 +7,9 @@  discard block
 block discarded – undo
7 7
 
8 8
     public function getLogin()
9 9
     {
10
-        if(!auth()->guest()) return redirect(cb()->getAdminUrl());
10
+        if(!auth()->guest()) {
11
+            return redirect(cb()->getAdminUrl());
12
+        }
11 13
 
12 14
         cbHook()->hookGetLogin();
13 15
 
@@ -28,7 +30,7 @@  discard block
 block discarded – undo
28 30
             } else {
29 31
                 return redirect(cb()->getLoginUrl())->with(['message'=>__('crudbooster.alert_password_wrong'),'message_type'=>'warning']);
30 32
             }
31
-        }catch (CBValidationException $e) {
33
+        } catch (CBValidationException $e) {
32 34
             return cb()->redirect(cb()->getAdminUrl("login"),$e->getMessage(),'warning');
33 35
         }
34 36
     }
@@ -57,11 +59,11 @@  discard block
 block discarded – undo
57 59
 
58 60
                 return redirect(cb()->getDeveloperUrl());
59 61
 
60
-            }else{
62
+            } else{
61 63
                 return cb()->redirectBack("Username and or password is wrong!");
62 64
             }
63 65
 
64
-        }catch (CBValidationException $e) {
66
+        } catch (CBValidationException $e) {
65 67
             return cb()->redirect(cb()->getLoginUrl(),$e->getMessage(),'warning');
66 68
         }
67 69
     }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
     public function getLogin()
10 10
     {
11
-        if(!auth()->guest()) return redirect(cb()->getAdminUrl());
11
+        if (!auth()->guest()) return redirect(cb()->getAdminUrl());
12 12
 
13 13
         cbHook()->hookGetLogin();
14 14
 
@@ -17,20 +17,20 @@  discard block
 block discarded – undo
17 17
 
18 18
     public function postLogin()
19 19
     {
20
-        try{
20
+        try {
21 21
             cb()->validation([
22 22
                 'email'=>'required|email',
23 23
                 'password'=>'required'
24 24
             ]);
25
-            $credential = request()->only(['email','password']);
25
+            $credential = request()->only(['email', 'password']);
26 26
             if (auth()->attempt($credential)) {
27 27
                 cbHook()->hookPostLogin();
28 28
                 return redirect(cb()->getAdminUrl());
29 29
             } else {
30
-                return redirect(cb()->getLoginUrl())->with(['message'=>__('crudbooster.alert_password_wrong'),'message_type'=>'warning']);
30
+                return redirect(cb()->getLoginUrl())->with(['message'=>__('crudbooster.alert_password_wrong'), 'message_type'=>'warning']);
31 31
             }
32
-        }catch (CBValidationException $e) {
33
-            return cb()->redirect(cb()->getAdminUrl("login"),$e->getMessage(),'warning');
32
+        } catch (CBValidationException $e) {
33
+            return cb()->redirect(cb()->getAdminUrl("login"), $e->getMessage(), 'warning');
34 34
         }
35 35
     }
36 36
 
@@ -45,25 +45,25 @@  discard block
 block discarded – undo
45 45
     }
46 46
 
47 47
     public function postLoginDeveloper() {
48
-        try{
48
+        try {
49 49
             cb()->validation([
50 50
                 'username'=>'required',
51 51
                 'password'=>'required'
52 52
             ]);
53 53
 
54
-            if(request('username') == config('crudbooster.DEV_USERNAME')
54
+            if (request('username') == config('crudbooster.DEV_USERNAME')
55 55
                 && request('password') == Cache::get("developer_password")) {
56 56
 
57 57
                 session(['developer'=>1]);
58 58
 
59 59
                 return redirect(cb()->getDeveloperUrl());
60 60
 
61
-            }else{
61
+            } else {
62 62
                 return cb()->redirectBack("Username and or password is wrong!");
63 63
             }
64 64
 
65
-        }catch (CBValidationException $e) {
66
-            return cb()->redirect(cb()->getLoginUrl(),$e->getMessage(),'warning');
65
+        } catch (CBValidationException $e) {
66
+            return cb()->redirect(cb()->getLoginUrl(), $e->getMessage(), 'warning');
67 67
         }
68 68
     }
69 69
 
Please login to merge, or discard this patch.
src/helpers/Module.php 2 patches
Braces   +37 added lines, -22 removed lines patch added patch discarded remove patch
@@ -76,45 +76,60 @@  discard block
 block discarded – undo
76 76
 
77 77
     public function canBrowse() {
78 78
         if($this->privilege) {
79
-            if($this->privilege->can_browse) return true;
80
-            else return false;
81
-        }else{
79
+            if($this->privilege->can_browse) {
80
+                return true;
81
+            } else {
82
+                return false;
83
+            }
84
+        } else{
82 85
             return true;
83 86
         }
84 87
     }
85 88
 
86 89
     public function canCreate() {
87 90
         if($this->privilege) {
88
-            if($this->privilege->can_create) return true;
89
-            else return false;
90
-        }else{
91
+            if($this->privilege->can_create) {
92
+                return true;
93
+            } else {
94
+                return false;
95
+            }
96
+        } else{
91 97
             return true;
92 98
         }
93 99
     }
94 100
 
95 101
     public function canRead() {
96 102
         if($this->privilege) {
97
-            if($this->privilege->can_read) return true;
98
-            else return false;
99
-        }else{
103
+            if($this->privilege->can_read) {
104
+                return true;
105
+            } else {
106
+                return false;
107
+            }
108
+        } else{
100 109
             return true;
101 110
         }
102 111
     }
103 112
 
104 113
     public function canUpdate() {
105 114
         if($this->privilege) {
106
-            if($this->privilege->can_update) return true;
107
-            else return false;
108
-        }else{
115
+            if($this->privilege->can_update) {
116
+                return true;
117
+            } else {
118
+                return false;
119
+            }
120
+        } else{
109 121
             return true;
110 122
         }
111 123
     }
112 124
 
113 125
     public function canDelete() {
114 126
         if($this->privilege) {
115
-            if($this->privilege->can_delete) return true;
116
-            else return false;
117
-        }else{
127
+            if($this->privilege->can_delete) {
128
+                return true;
129
+            } else {
130
+                return false;
131
+            }
132
+        } else{
118 133
             return true;
119 134
         }
120 135
     }
@@ -123,7 +138,7 @@  discard block
 block discarded – undo
123 138
     {
124 139
         if($this->controller_class && method_exists($this->controller_class, 'getAdd')) {
125 140
             return action($this->controller.'@getAdd');
126
-        }else{
141
+        } else{
127 142
             return null;
128 143
         }
129 144
     }
@@ -132,7 +147,7 @@  discard block
 block discarded – undo
132 147
     {
133 148
         if($this->controller_class && method_exists($this->controller_class, 'postAddSave')) {
134 149
             return action($this->controller.'@postAddSave');
135
-        }else{
150
+        } else{
136 151
             return null;
137 152
         }
138 153
     }
@@ -141,7 +156,7 @@  discard block
 block discarded – undo
141 156
     {
142 157
         if($this->controller_class && method_exists($this->controller_class, 'getEdit')) {
143 158
             return action($this->controller.'@getEdit',['id'=>$id]);
144
-        }else{
159
+        } else{
145 160
             return null;
146 161
         }
147 162
     }
@@ -150,7 +165,7 @@  discard block
 block discarded – undo
150 165
     {
151 166
         if(method_exists($this->controller_class, 'postEditSave')) {
152 167
             return action($this->controller.'@postEditSave',['id'=>$id]);
153
-        }else{
168
+        } else{
154 169
             return null;
155 170
         }
156 171
     }
@@ -159,7 +174,7 @@  discard block
 block discarded – undo
159 174
     {
160 175
         if($this->controller_class && method_exists($this->controller_class, 'getDetail')) {
161 176
             return action($this->controller.'@getDetail',['id'=>$id]);
162
-        }else{
177
+        } else{
163 178
             return null;
164 179
         }
165 180
     }
@@ -168,7 +183,7 @@  discard block
 block discarded – undo
168 183
     {
169 184
         if($this->controller_class && method_exists($this->controller_class, 'getDelete')) {
170 185
             return action($this->controller.'@getDelete',['id'=>$id]);
171
-        }else{
186
+        } else{
172 187
             return null;
173 188
         }
174 189
     }
@@ -177,7 +192,7 @@  discard block
 block discarded – undo
177 192
     {
178 193
         if($this->controller_class && method_exists($this->controller_class, 'getIndex')) {
179 194
             return trim(action($this->controller.'@getIndex').'/'.$path,'/');
180
-        }else{
195
+        } else{
181 196
             return null;
182 197
         }
183 198
     }
Please login to merge, or discard this patch.
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -25,16 +25,16 @@  discard block
 block discarded – undo
25 25
     {
26 26
         $routeArray = request()->route()->getAction();
27 27
         $this->controller = class_basename($routeArray['controller']);
28
-        $this->controller = strtok($this->controller,"@");
28
+        $this->controller = strtok($this->controller, "@");
29 29
 
30 30
         $className = "\\".$routeArray["namespace"]."\\".$this->controller;
31
-        if(class_exists($className)) {
32
-            $this->module = cb()->find("cb_modules",["controller"=>$this->controller]);
33
-            if($this->module) {
31
+        if (class_exists($className)) {
32
+            $this->module = cb()->find("cb_modules", ["controller"=>$this->controller]);
33
+            if ($this->module) {
34 34
                 $this->controller_class = new $className();
35
-                $this->menu = cb()->find("cb_menus",["cb_modules_id"=>$this->module->id]);
36
-                $this->menu = (!$this->menu)?cb()->find("cb_menus",["type"=>"path","path"=>request()->segment(2)]):$this->menu;
37
-                if($this->menu) {
35
+                $this->menu = cb()->find("cb_menus", ["cb_modules_id"=>$this->module->id]);
36
+                $this->menu = (!$this->menu) ?cb()->find("cb_menus", ["type"=>"path", "path"=>request()->segment(2)]) : $this->menu;
37
+                if ($this->menu) {
38 38
                     $this->privilege = DB::table("cb_role_privileges")
39 39
                         ->where("cb_menus_id", $this->menu->id)
40 40
                         ->where("cb_roles_id", cb()->session()->roleId())
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
     }
54 54
 
55 55
     public function getData($key) {
56
-        if($this->controller_class) {
56
+        if ($this->controller_class) {
57 57
             $value = $this->controller_class->getData($key);
58
-            if(isset($value)) {
58
+            if (isset($value)) {
59 59
                 return $value;
60 60
             }
61 61
         }
@@ -66,128 +66,128 @@  discard block
 block discarded – undo
66 66
      * @return CBController
67 67
      */
68 68
     public function getController() {
69
-        return ($this->controller_class)?$this->controller_class:null;
69
+        return ($this->controller_class) ? $this->controller_class : null;
70 70
     }
71 71
 
72 72
     public function getPageTitle()
73 73
     {
74
-        return ($this->controller_class)?$this->controller_class->getData("page_title")?:cb()->getAppName():null;
74
+        return ($this->controller_class) ? $this->controller_class->getData("page_title") ?: cb()->getAppName() : null;
75 75
     }
76 76
 
77 77
     public function getTable()
78 78
     {
79
-        return ($this->controller_class)?$this->controller_class->getData("table"):null;
79
+        return ($this->controller_class) ? $this->controller_class->getData("table") : null;
80 80
     }
81 81
 
82 82
     public function getPageIcon()
83 83
     {
84
-        return ($this->controller_class)?$this->controller_class->getData('page_icon')?:"fa fa-bars":null;
84
+        return ($this->controller_class) ? $this->controller_class->getData('page_icon') ?: "fa fa-bars" : null;
85 85
     }
86 86
 
87 87
     public function canBrowse() {
88
-        if($this->privilege) {
89
-            if($this->privilege->can_browse) return true;
88
+        if ($this->privilege) {
89
+            if ($this->privilege->can_browse) return true;
90 90
             else return false;
91
-        }else{
91
+        } else {
92 92
             return true;
93 93
         }
94 94
     }
95 95
 
96 96
     public function canCreate() {
97
-        if($this->privilege) {
98
-            if($this->privilege->can_create) return true;
97
+        if ($this->privilege) {
98
+            if ($this->privilege->can_create) return true;
99 99
             else return false;
100
-        }else{
100
+        } else {
101 101
             return true;
102 102
         }
103 103
     }
104 104
 
105 105
     public function canRead() {
106
-        if($this->privilege) {
107
-            if($this->privilege->can_read) return true;
106
+        if ($this->privilege) {
107
+            if ($this->privilege->can_read) return true;
108 108
             else return false;
109
-        }else{
109
+        } else {
110 110
             return true;
111 111
         }
112 112
     }
113 113
 
114 114
     public function canUpdate() {
115
-        if($this->privilege) {
116
-            if($this->privilege->can_update) return true;
115
+        if ($this->privilege) {
116
+            if ($this->privilege->can_update) return true;
117 117
             else return false;
118
-        }else{
118
+        } else {
119 119
             return true;
120 120
         }
121 121
     }
122 122
 
123 123
     public function canDelete() {
124
-        if($this->privilege) {
125
-            if($this->privilege->can_delete) return true;
124
+        if ($this->privilege) {
125
+            if ($this->privilege->can_delete) return true;
126 126
             else return false;
127
-        }else{
127
+        } else {
128 128
             return true;
129 129
         }
130 130
     }
131 131
 
132 132
     public function addURL()
133 133
     {
134
-        if($this->controller_class && method_exists($this->controller_class, 'getAdd')) {
134
+        if ($this->controller_class && method_exists($this->controller_class, 'getAdd')) {
135 135
             return action($this->controller.'@getAdd');
136
-        }else{
136
+        } else {
137 137
             return null;
138 138
         }
139 139
     }
140 140
 
141 141
     public function addSaveURL()
142 142
     {
143
-        if($this->controller_class && method_exists($this->controller_class, 'postAddSave')) {
143
+        if ($this->controller_class && method_exists($this->controller_class, 'postAddSave')) {
144 144
             return action($this->controller.'@postAddSave');
145
-        }else{
145
+        } else {
146 146
             return null;
147 147
         }
148 148
     }
149 149
 
150 150
     public function editURL($id = null)
151 151
     {
152
-        if($this->controller_class && method_exists($this->controller_class, 'getEdit')) {
153
-            return action($this->controller.'@getEdit',['id'=>$id]);
154
-        }else{
152
+        if ($this->controller_class && method_exists($this->controller_class, 'getEdit')) {
153
+            return action($this->controller.'@getEdit', ['id'=>$id]);
154
+        } else {
155 155
             return null;
156 156
         }
157 157
     }
158 158
 
159 159
     public function editSaveURL($id = null)
160 160
     {
161
-        if(method_exists($this->controller_class, 'postEditSave')) {
162
-            return action($this->controller.'@postEditSave',['id'=>$id]);
163
-        }else{
161
+        if (method_exists($this->controller_class, 'postEditSave')) {
162
+            return action($this->controller.'@postEditSave', ['id'=>$id]);
163
+        } else {
164 164
             return null;
165 165
         }
166 166
     }
167 167
 
168
-    public function detailURL($id=null)
168
+    public function detailURL($id = null)
169 169
     {
170
-        if($this->controller_class && method_exists($this->controller_class, 'getDetail')) {
171
-            return action($this->controller.'@getDetail',['id'=>$id]);
172
-        }else{
170
+        if ($this->controller_class && method_exists($this->controller_class, 'getDetail')) {
171
+            return action($this->controller.'@getDetail', ['id'=>$id]);
172
+        } else {
173 173
             return null;
174 174
         }
175 175
     }
176 176
 
177
-    public function deleteURL($id=null)
177
+    public function deleteURL($id = null)
178 178
     {
179
-        if($this->controller_class && method_exists($this->controller_class, 'getDelete')) {
180
-            return action($this->controller.'@getDelete',['id'=>$id]);
181
-        }else{
179
+        if ($this->controller_class && method_exists($this->controller_class, 'getDelete')) {
180
+            return action($this->controller.'@getDelete', ['id'=>$id]);
181
+        } else {
182 182
             return null;
183 183
         }
184 184
     }
185 185
 
186 186
     public function url($path = null)
187 187
     {
188
-        if($this->controller_class && method_exists($this->controller_class, 'getIndex')) {
189
-            return trim(action($this->controller.'@getIndex').'/'.$path,'/');
190
-        }else{
188
+        if ($this->controller_class && method_exists($this->controller_class, 'getIndex')) {
189
+            return trim(action($this->controller.'@getIndex').'/'.$path, '/');
190
+        } else {
191 191
             return null;
192 192
         }
193 193
     }
Please login to merge, or discard this patch.
src/types/datetime/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/types/radio/Radio.php 2 patches
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.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -35,13 +35,13 @@  discard block
 block discarded – undo
35 35
      */
36 36
     public function optionsFromTable($table, $key_field, $display_field, $SQLCondition = null) {
37 37
 
38
-        if(strpos($table,"App\Models")!==false) {
38
+        if (strpos($table, "App\Models") !== false) {
39 39
             $table = new $table();
40 40
             $table = $table::$tableName;
41 41
         }
42 42
 
43 43
         $data = DB::table($table);
44
-        if($SQLCondition && is_callable($SQLCondition)) {
44
+        if ($SQLCondition && is_callable($SQLCondition)) {
45 45
             $data = call_user_func($SQLCondition, $data);
46 46
         }elseif ($SQLCondition && is_string($SQLCondition)) {
47 47
             $data->whereRaw($SQLCondition);
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         $data = $data->get();
50 50
         $options = [];
51 51
         foreach ($data as $d) {
52
-            $options[ $d->$key_field ] = $d->$display_field;
52
+            $options[$d->$key_field] = $d->$display_field;
53 53
         }
54 54
         $this->options($options);
55 55
     }
Please login to merge, or discard this patch.
src/types/select/Hook.php 2 patches
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.
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->leftjoin($option["table"],$option["table"].'.'.$option["key_field"],"=", $column->getName());
24
+            $query->leftjoin($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.
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
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.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -40,13 +40,13 @@  discard block
 block discarded – undo
40 40
      * @param $SQLCondition string|callable
41 41
      */
42 42
     public function optionsFromTable($table, $key_field, $display_field, $SQLCondition = null) {
43
-        if(strpos($table,"App\Models")!==false) {
43
+        if (strpos($table, "App\Models") !== false) {
44 44
             $table = new $table();
45 45
             $table = $table::$tableName;
46 46
         }
47 47
 
48 48
         $data = DB::table($table);
49
-        if($SQLCondition && is_callable($SQLCondition)) {
49
+        if ($SQLCondition && is_callable($SQLCondition)) {
50 50
             $data = call_user_func($SQLCondition, $data);
51 51
         }elseif ($SQLCondition && is_string($SQLCondition)) {
52 52
             $data->whereRaw($SQLCondition);
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
         $data = $data->get();
55 55
         $options = [];
56 56
         foreach ($data as $d) {
57
-            $options[ $d->$key_field ] = $d->$display_field;
57
+            $options[$d->$key_field] = $d->$display_field;
58 58
         }
59 59
         $this->options($options);
60 60
     }
Please login to merge, or discard this patch.
src/types/select/Select.php 2 patches
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.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -41,13 +41,13 @@  discard block
 block discarded – undo
41 41
      */
42 42
     public function optionsFromTable($table, $key_field, $display_field, $SQLCondition = null) {
43 43
 
44
-        if(strpos($table,"App\Models")!==false) {
44
+        if (strpos($table, "App\Models") !== false) {
45 45
             $table = new $table();
46 46
             $table = $table::$tableName;
47 47
         }
48 48
 
49 49
         $data = DB::table($table);
50
-        if($SQLCondition && is_callable($SQLCondition)) {
50
+        if ($SQLCondition && is_callable($SQLCondition)) {
51 51
             $data = call_user_func($SQLCondition, $data);
52 52
         }elseif ($SQLCondition && is_string($SQLCondition)) {
53 53
             $data->whereRaw($SQLCondition);
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
         $data = $data->get();
56 56
         $options = [];
57 57
         foreach ($data as $d) {
58
-            $options[ $d->$key_field ] = $d->$display_field;
58
+            $options[$d->$key_field] = $d->$display_field;
59 59
         }
60 60
         $data = columnSingleton()->getColumn($this->index);
61 61
         /** @var $data SelectModel */
62
-        $data->setOptionsFromTable(["table"=>$table,"key_field"=>$key_field,"display_field"=>$display_field,"sql_condition"=>$SQLCondition]);
62
+        $data->setOptionsFromTable(["table"=>$table, "key_field"=>$key_field, "display_field"=>$display_field, "sql_condition"=>$SQLCondition]);
63 63
         columnSingleton()->setColumn($this->index, $data);
64 64
 
65 65
         $this->options($options);
@@ -75,10 +75,10 @@  discard block
 block discarded – undo
75 75
         columnSingleton()->setColumn($this->index, $data);
76 76
 
77 77
         $result = call_user_func($query);
78
-        if($result) {
78
+        if ($result) {
79 79
             $options = [];
80
-            foreach($result as $r) {
81
-                $options[ $r->key ] = $r->label;
80
+            foreach ($result as $r) {
81
+                $options[$r->key] = $r->label;
82 82
             }
83 83
             $this->options($options);
84 84
         }
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.