@@ -8,28 +8,28 @@ discard block |
||
8 | 8 | | --------------------------------------------------------------------------------------------------------------- |
9 | 9 | | |
10 | 10 | */ |
11 | -if (! function_exists('cbModulesNS')) { |
|
11 | +if (!function_exists('cbModulesNS')) { |
|
12 | 12 | function cbModulesNS($path = '') |
13 | 13 | { |
14 | 14 | return '\crocodicstudio\crudbooster\Modules\\'.$path; |
15 | 15 | } |
16 | 16 | } |
17 | 17 | |
18 | -if (! function_exists('cbAdminPath')) { |
|
18 | +if (!function_exists('cbAdminPath')) { |
|
19 | 19 | function cbAdminPath() |
20 | 20 | { |
21 | 21 | return cbConfig('ADMIN_PATH'); |
22 | 22 | } |
23 | 23 | } |
24 | 24 | |
25 | -if (! function_exists('ctrlNamespace')) { |
|
25 | +if (!function_exists('ctrlNamespace')) { |
|
26 | 26 | function ctrlNamespace() |
27 | 27 | { |
28 | 28 | return 'App\Http\Controllers'; |
29 | 29 | } |
30 | 30 | } |
31 | 31 | |
32 | -if (! function_exists('is_checked')) { |
|
32 | +if (!function_exists('is_checked')) { |
|
33 | 33 | /** |
34 | 34 | * @param $format |
35 | 35 | * @param $value |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | } |
54 | 54 | } |
55 | 55 | |
56 | -if (! function_exists('controllers_dir')) { |
|
56 | +if (!function_exists('controllers_dir')) { |
|
57 | 57 | function controllers_dir() |
58 | 58 | { |
59 | 59 | $_ = DIRECTORY_SEPARATOR; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
64 | -if (! function_exists('controller_path')) { |
|
64 | +if (!function_exists('controller_path')) { |
|
65 | 65 | function controller_path($controller) |
66 | 66 | { |
67 | 67 | $_ = DIRECTORY_SEPARATOR; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | } |
70 | 70 | } |
71 | 71 | |
72 | -if (! function_exists('extract_unit')) { |
|
72 | +if (!function_exists('extract_unit')) { |
|
73 | 73 | /* |
74 | 74 | Credits: Bit Repository |
75 | 75 | URL: http://www.bitrepository.com/extract-content-between-two-delimiters-with-php.html |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | } |
88 | 88 | } |
89 | 89 | |
90 | -if (! function_exists('now')) { |
|
90 | +if (!function_exists('now')) { |
|
91 | 91 | function now() |
92 | 92 | { |
93 | 93 | return date('Y-m-d H:i:s'); |
@@ -101,14 +101,14 @@ discard block |
||
101 | 101 | | $name = name of input |
102 | 102 | | |
103 | 103 | */ |
104 | -if (! function_exists('g')) { |
|
104 | +if (!function_exists('g')) { |
|
105 | 105 | function g($name) |
106 | 106 | { |
107 | 107 | return Request::get($name); |
108 | 108 | } |
109 | 109 | } |
110 | 110 | |
111 | -if (! function_exists('cbTrans')) { |
|
111 | +if (!function_exists('cbTrans')) { |
|
112 | 112 | /** |
113 | 113 | * Translate the given message. |
114 | 114 | * |
@@ -122,34 +122,34 @@ discard block |
||
122 | 122 | } |
123 | 123 | } |
124 | 124 | |
125 | -if (! function_exists('cbAsset')) { |
|
125 | +if (!function_exists('cbAsset')) { |
|
126 | 126 | function cbAsset($key) |
127 | 127 | { |
128 | 128 | return asset('vendor/crudbooster/assets/'.$key); |
129 | 129 | } |
130 | 130 | } |
131 | 131 | |
132 | -if (! function_exists('cbScript')) { |
|
132 | +if (!function_exists('cbScript')) { |
|
133 | 133 | function cbScript($key) |
134 | 134 | { |
135 | 135 | return '<script src="'.cbAsset($key).'" type="text/javascript"></script>'; |
136 | 136 | } |
137 | 137 | } |
138 | 138 | |
139 | -if (! function_exists('cbStyleSheet')) { |
|
139 | +if (!function_exists('cbStyleSheet')) { |
|
140 | 140 | function cbStyleSheet($key) |
141 | 141 | { |
142 | 142 | return '<link rel="stylesheet" type="text/css" href="'.cbAsset($key).'"/>'; |
143 | 143 | } |
144 | 144 | } |
145 | 145 | |
146 | -if (! function_exists('cbConfig')) { |
|
146 | +if (!function_exists('cbConfig')) { |
|
147 | 147 | function cbConfig($key, $default = null) |
148 | 148 | { |
149 | 149 | return config('crudbooster.'.$key, $default); |
150 | 150 | } |
151 | 151 | } |
152 | -if (! function_exists('makeValidationForHTML')) { |
|
152 | +if (!function_exists('makeValidationForHTML')) { |
|
153 | 153 | function makeValidationForHTML($rules) |
154 | 154 | { |
155 | 155 | $validation = []; |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
170 | -if (! function_exists('findSelected')) { |
|
170 | +if (!function_exists('findSelected')) { |
|
171 | 171 | /** |
172 | 172 | * @param $rawvalue |
173 | 173 | * @param $form |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | */ |
177 | 177 | function findSelected($rawvalue, $form, $optionValue) |
178 | 178 | { |
179 | - if (! $rawvalue) { |
|
179 | + if (!$rawvalue) { |
|
180 | 180 | return ''; |
181 | 181 | } |
182 | 182 | $value = $rawvalue; |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | return $selected; |
199 | 199 | } |
200 | 200 | } |
201 | -if (! function_exists('array_get_keys')) { |
|
201 | +if (!function_exists('array_get_keys')) { |
|
202 | 202 | |
203 | 203 | /** |
204 | 204 | * @param array $_array |
@@ -214,28 +214,28 @@ discard block |
||
214 | 214 | } |
215 | 215 | } |
216 | 216 | |
217 | -if (! function_exists('cbGetSetting')) { |
|
217 | +if (!function_exists('cbGetSetting')) { |
|
218 | 218 | function cbGetSetting($name) |
219 | 219 | { |
220 | 220 | return \crocodicstudio\crudbooster\Modules\SettingModule\SettingRepo::getSetting($name); |
221 | 221 | } |
222 | 222 | } |
223 | 223 | |
224 | -if (! function_exists('backWithMsg')) { |
|
224 | +if (!function_exists('backWithMsg')) { |
|
225 | 225 | function backWithMsg($msg, $type = 'success') |
226 | 226 | { |
227 | 227 | sendAndTerminate(redirect()->back()->with(['message_type' => $type, 'message' => $msg])); |
228 | 228 | } |
229 | 229 | } |
230 | 230 | |
231 | -if (! function_exists('underField')) { |
|
231 | +if (!function_exists('underField')) { |
|
232 | 232 | function underField($help, $error) |
233 | 233 | { |
234 | - $error = $error ? "<i class='fa fa-info-circle'></i> $error":'' ; |
|
234 | + $error = $error ? "<i class='fa fa-info-circle'></i> $error" : ''; |
|
235 | 235 | return "<div class='text-danger'>$error</div><p class='help-block'>$help</p>"; |
236 | 236 | } |
237 | 237 | } |
238 | -if (! function_exists('cbIcon')) { |
|
238 | +if (!function_exists('cbIcon')) { |
|
239 | 239 | function cbIcon($icon) |
240 | 240 | { |
241 | 241 | return '<i class=\'fa fa-'.$icon.'\'></i>'; |
@@ -8,7 +8,7 @@ |
||
8 | 8 | { |
9 | 9 | public function showForm($id) |
10 | 10 | { |
11 | - $row = ModulesRepo::find($id);; |
|
11 | + $row = ModulesRepo::find($id); ; |
|
12 | 12 | |
13 | 13 | $columns = DbInspector::getTableCols($row->table_name); |
14 | 14 |
@@ -63,7 +63,7 @@ |
||
63 | 63 | private static function getControllerMethods($ctrl) |
64 | 64 | { |
65 | 65 | $controller_methods = (new \ReflectionClass($ctrl))->getMethods(\ReflectionMethod::IS_PUBLIC); |
66 | - $controller_methods = array_filter($controller_methods, function ($method) { |
|
66 | + $controller_methods = array_filter($controller_methods, function($method) { |
|
67 | 67 | return ($method->class !== 'Illuminate\Routing\Controller' && $method->name !== 'getIndex'); |
68 | 68 | }); |
69 | 69 |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | $datatableWhere = urldecode(request('datatable_where')); |
16 | 16 | $foreignKeyName = request('fk_name'); |
17 | 17 | $foreignKeyValue = request('fk_value'); |
18 | - if (! $table || ! $label || ! $foreignKeyName || ! $foreignKeyValue) { |
|
18 | + if (!$table || !$label || !$foreignKeyName || !$foreignKeyValue) { |
|
19 | 19 | return response()->json([]); |
20 | 20 | } |
21 | 21 | $query = DB::table($table); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | public function getDataQuery() |
52 | 52 | { |
53 | 53 | $key = request('query'); |
54 | - if (! Cache::has($key)) { |
|
54 | + if (!Cache::has($key)) { |
|
55 | 55 | return response()->json(['items' => []]); |
56 | 56 | } |
57 | 57 | $query = Cache::get($key); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | if (request('q')) { |
94 | 94 | return; |
95 | 95 | } |
96 | - $result->where(function ($where) use ($columns) { |
|
96 | + $result->where(function($where) use ($columns) { |
|
97 | 97 | foreach ($columns as $c => $col) { |
98 | 98 | if ($c == 0) { |
99 | 99 | $where->where($col, 'like', '%'.request('q').'%'); |
@@ -74,7 +74,7 @@ |
||
74 | 74 | * @param $name |
75 | 75 | * @return mixed |
76 | 76 | */ |
77 | - /* private function handleBase64($value, $uploads_format_candidate, $row_assign, $name) |
|
77 | + /* private function handleBase64($value, $uploads_format_candidate, $row_assign, $name) |
|
78 | 78 | { |
79 | 79 | $filedata = base64_decode($value); |
80 | 80 | $f = finfo_open(); |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | */ |
227 | 227 | private function filterRows($data, $parameters, $posts, $table, $type_except) |
228 | 228 | { |
229 | - $data->where(function ($w) use ($parameters, $posts, $table, $type_except) { |
|
229 | + $data->where(function($w) use ($parameters, $posts, $table, $type_except) { |
|
230 | 230 | foreach ($parameters as $param) { |
231 | 231 | $name = $param['name']; |
232 | 232 | $type = $param['type']; |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | $row->$k = asset($v); |
319 | 319 | } |
320 | 320 | |
321 | - if (! in_array($k, $responses_fields)) { |
|
321 | + if (!in_array($k, $responses_fields)) { |
|
322 | 322 | unset($row[$k]); |
323 | 323 | } |
324 | 324 | } |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | $rows->$k = asset($v); |
382 | 382 | } |
383 | 383 | |
384 | - if (! in_array($k, $responses_fields)) { |
|
384 | + if (!in_array($k, $responses_fields)) { |
|
385 | 385 | unset($row[$k]); |
386 | 386 | } |
387 | 387 | } |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | $subquery = $resp['subquery']; |
404 | 404 | $used = intval($resp['used']); |
405 | 405 | |
406 | - if ($used == 0 && ! DbInspector::isForeignKey($name)) { |
|
406 | + if ($used == 0 && !DbInspector::isForeignKey($name)) { |
|
407 | 407 | continue; |
408 | 408 | } |
409 | 409 | |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | */ |
459 | 459 | private function applyLike($data, $search_in, $value) |
460 | 460 | { |
461 | - $data->where(function ($w) use ($search_in, $value) { |
|
461 | + $data->where(function($w) use ($search_in, $value) { |
|
462 | 462 | foreach ($search_in as $k => $field) { |
463 | 463 | if ($k == 0) { |
464 | 464 | $w->where($field, "like", "%$value%"); |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | private function validateMethodType($row_api, $result, $debugModeMessage, $posts) |
507 | 507 | { |
508 | 508 | $method_type = $row_api->method_type; |
509 | - if (! $method_type || ! Request::isMethod($method_type)) { |
|
509 | + if (!$method_type || !Request::isMethod($method_type)) { |
|
510 | 510 | $result['api_status'] = 0; |
511 | 511 | $result['api_message'] = "The request method is not allowed !"; |
512 | 512 | |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | */ |
545 | 545 | private function checkApiDefined($row_api, $result, $debugModeMessage, $posts) |
546 | 546 | { |
547 | - if (! $row_api) { |
|
547 | + if (!$row_api) { |
|
548 | 548 | $result['api_status'] = 0; |
549 | 549 | $result['api_message'] = 'Sorry this API is no longer available, maybe has changed by admin, or please make sure api url is correct.'; |
550 | 550 | |
@@ -611,11 +611,11 @@ discard block |
||
611 | 611 | $value = $param['config']; |
612 | 612 | } |
613 | 613 | |
614 | - if ($required && $type == 'password' && ! Hash::check($value, $row->{$name})) { |
|
614 | + if ($required && $type == 'password' && !Hash::check($value, $row->{$name})) { |
|
615 | 615 | $this->passwordError($result, $debugModeMessage, $posts); |
616 | 616 | } |
617 | 617 | |
618 | - if (! $required && $used && $value && ! Hash::check($value, $row->{$name})) { |
|
618 | + if (!$required && $used && $value && !Hash::check($value, $row->{$name})) { |
|
619 | 619 | $this->passwordError($result, $debugModeMessage, $posts); |
620 | 620 | } |
621 | 621 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $data['parent_field'] = CB::getTableForeignKey(request('parent_table'), $this->table); |
109 | 109 | } |
110 | 110 | |
111 | - if (! $data['parent_field']) { |
|
111 | + if (!$data['parent_field']) { |
|
112 | 112 | return $data; |
113 | 113 | } |
114 | 114 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | */ |
127 | 127 | private function _filterForParent($result) |
128 | 128 | { |
129 | - if (! request('parent_id')) { |
|
129 | + if (!request('parent_id')) { |
|
130 | 130 | return null; |
131 | 131 | } |
132 | 132 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | */ |
141 | 141 | private function _filterOutSoftDeleted($tableColumns, $result) |
142 | 142 | { |
143 | - if (! in_array('deleted_at', $tableColumns)) { |
|
143 | + if (!in_array('deleted_at', $tableColumns)) { |
|
144 | 144 | return; |
145 | 145 | } |
146 | 146 | $result->where($this->table.'.deleted_at', '=', null); |
@@ -199,9 +199,9 @@ discard block |
||
199 | 199 | private function _applyWhereAndQfilters($result, $columnsTable, $table) |
200 | 200 | { |
201 | 201 | if (request('q')) { |
202 | - $result->where(function ($query) use ($columnsTable) { |
|
202 | + $result->where(function($query) use ($columnsTable) { |
|
203 | 203 | foreach ($columnsTable as $col) { |
204 | - if (! $col['field_with']) { |
|
204 | + if (!$col['field_with']) { |
|
205 | 205 | continue; |
206 | 206 | } |
207 | 207 | $query->orwhere($col['field_with'], "like", "%".request("q")."%"); |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | return CRUDBooster::adminPath($module['path']).'?parent_table='.$table_parent.'&parent_columns=' |
274 | 274 | .$module['parent_columns'].'&parent_columns_alias=' |
275 | 275 | .$module['parent_columns_alias'].'&parent_id=[' |
276 | - .(! isset($module['custom_parent_id']) ? "id" : $module['custom_parent_id']) |
|
276 | + .(!isset($module['custom_parent_id']) ? "id" : $module['custom_parent_id']) |
|
277 | 277 | .']&return_url='.urlencode(Request::fullUrl()).'&foreign_key=' |
278 | 278 | .$module['foreign_key'].'&label='.urlencode($module['label']); |
279 | 279 | } |
@@ -9,10 +9,10 @@ discard block |
||
9 | 9 | $colsItem = self::extractLines($code, $type); |
10 | 10 | |
11 | 11 | foreach ($colsItem as &$item) { |
12 | - $item = str_replace(' ','', $item); |
|
12 | + $item = str_replace(' ', '', $item); |
|
13 | 13 | // "['label'=>'KanapeType','name'=>'kanape_type',];\r\n" |
14 | 14 | |
15 | - $item = str_replace('\',]',']', $item); // replaces: ',] with ] |
|
15 | + $item = str_replace('\',]', ']', $item); // replaces: ',] with ] |
|
16 | 16 | // "['label'=>'KanapeType','name'=>'kanape_type];\r\n" |
17 | 17 | |
18 | 18 | $item = trim($item); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | } elseif (strpos($s, 'callback') !== false) { |
132 | 132 | $colInnerItem['callback'] = self::parseCallback($s); |
133 | 133 | } else { |
134 | - $s = str_replace("'", '',$s); |
|
134 | + $s = str_replace("'", '', $s); |
|
135 | 135 | $sSplit = explode('=>', $s); |
136 | 136 | $colInnerItem[$sSplit[0]] = $sSplit[1]; |
137 | 137 | } |
@@ -62,7 +62,7 @@ |
||
62 | 62 | $columnScript[] = str_repeat(' ', 12).'$this->col[] = [];'; |
63 | 63 | foreach ($labels as $i => $label) { |
64 | 64 | |
65 | - if (! $name[$i]) { |
|
65 | + if (!$name[$i]) { |
|
66 | 66 | continue; |
67 | 67 | } |
68 | 68 |