@@ -8,7 +8,9 @@ discard block |
||
8 | 8 | |
9 | 9 | public function getLogin() |
10 | 10 | { |
11 | - if(!auth()->guest()) return redirect(cb()->getAdminUrl()); |
|
11 | + if(!auth()->guest()) { |
|
12 | + return redirect(cb()->getAdminUrl()); |
|
13 | + } |
|
12 | 14 | |
13 | 15 | cbHook()->hookGetLogin(); |
14 | 16 | |
@@ -29,7 +31,7 @@ discard block |
||
29 | 31 | } else { |
30 | 32 | return redirect(cb()->getLoginUrl())->with(['message'=>__('crudbooster.password_and_username_is_wrong'),'message_type'=>'warning']); |
31 | 33 | } |
32 | - }catch (CBValidationException $e) { |
|
34 | + } catch (CBValidationException $e) { |
|
33 | 35 | return cb()->redirect(cb()->getAdminUrl("login"),$e->getMessage(),'warning'); |
34 | 36 | } |
35 | 37 | } |
@@ -58,11 +60,11 @@ discard block |
||
58 | 60 | |
59 | 61 | return redirect(cb()->getDeveloperUrl()); |
60 | 62 | |
61 | - }else{ |
|
63 | + } else{ |
|
62 | 64 | return cb()->redirectBack(__("crudbooster.password_and_username_is_wrong")); |
63 | 65 | } |
64 | 66 | |
65 | - }catch (CBValidationException $e) { |
|
67 | + } catch (CBValidationException $e) { |
|
66 | 68 | return cb()->redirect(cb()->getLoginUrl(),$e->getMessage(),'warning'); |
67 | 69 | } |
68 | 70 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | if(Str::contains(strtolower($item),["title","name","label"])) { |
56 | 56 | $display = true; |
57 | - }else{ |
|
57 | + } else{ |
|
58 | 58 | $display = false; |
59 | 59 | } |
60 | 60 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | if(Schema::hasTable($relationTable)) { |
90 | 90 | $optionTable = $relationTable; |
91 | 91 | } |
92 | - }elseif (Str::substr(strtolower($column),0,3) == "id_") { |
|
92 | + } elseif (Str::substr(strtolower($column),0,3) == "id_") { |
|
93 | 93 | $relationTable = Str::substr($column,3); |
94 | 94 | if(Schema::hasTable($relationTable)) { |
95 | 95 | $optionTable = $relationTable; |
@@ -102,15 +102,15 @@ discard block |
||
102 | 102 | |
103 | 103 | if(Str::contains(strtolower($label),["photo","image","picture","gambar"])) { |
104 | 104 | $type = "image"; |
105 | - }elseif (Str::contains(strtolower($label),["email","mail"])) { |
|
105 | + } elseif (Str::contains(strtolower($label),["email","mail"])) { |
|
106 | 106 | $type = "email"; |
107 | - }elseif (Str::contains(strtolower($label),["description","content","detail"])) { |
|
107 | + } elseif (Str::contains(strtolower($label),["description","content","detail"])) { |
|
108 | 108 | $type = "wysiwyg"; |
109 | - }elseif (Str::contains(strtolower($label),["price","money","grand_total","tax"])) { |
|
109 | + } elseif (Str::contains(strtolower($label),["price","money","grand_total","tax"])) { |
|
110 | 110 | $type = "money"; |
111 | - }elseif (Str::contains(strtolower($label),["quantity","qty","total","phone","telp"])) { |
|
111 | + } elseif (Str::contains(strtolower($label),["quantity","qty","total","phone","telp"])) { |
|
112 | 112 | $type = "number"; |
113 | - }elseif (Str::contains(strtolower($label),["date"])) { |
|
113 | + } elseif (Str::contains(strtolower($label),["date"])) { |
|
114 | 114 | $type = "date"; |
115 | 115 | } |
116 | 116 | |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | |
197 | 197 | if($item['length']) { |
198 | 198 | $structureItems .= "\$table->".$item['type_data']."('".$item['field_name']."', ".$item['length'].")$nullable;\n\t\t\t"; |
199 | - }else{ |
|
199 | + } else{ |
|
200 | 200 | $structureItems .= "\$table->".$item['type_data']."('".$item['field_name']."')$nullable;\n\t\t\t"; |
201 | 201 | } |
202 | 202 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | private function existsPrivilege($cb_roles_id, $cb_menus_id) { |
89 | 89 | if($row = cb()->find("cb_role_privileges",['cb_roles_id'=>$cb_roles_id,'cb_menus_id'=>$cb_menus_id])) { |
90 | 90 | return $row->id; |
91 | - }else{ |
|
91 | + } else{ |
|
92 | 92 | return null; |
93 | 93 | } |
94 | 94 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $privilege["can_delete"] = @$access['can_delete']?:0; |
112 | 112 | if($privilege_id = $this->existsPrivilege($id, $menus_id)) { |
113 | 113 | DB::table("cb_role_privileges")->where("id", $privilege_id)->update($privilege); |
114 | - }else{ |
|
114 | + } else{ |
|
115 | 115 | DB::table("cb_role_privileges")->insert($privilege); |
116 | 116 | } |
117 | 117 | } |
@@ -80,15 +80,15 @@ discard block |
||
80 | 80 | } |
81 | 81 | $scaffold .= '$this->add' . $methodName . '("' . $label . '","' . $column . '")->options('.min_var_export($optResult).')' . $required . $indexShow . $detailShow . $addShow . $editShow . $help . ';' . "\n\t\t"; |
82 | 82 | } |
83 | - }elseif (in_array($field['column_type'],['radio_table','select_table'])) { |
|
83 | + } elseif (in_array($field['column_type'],['radio_table','select_table'])) { |
|
84 | 84 | if ($optionTable && $optionValue && $optionDisplay) { |
85 | 85 | $scaffold .= '$this->add' . $methodName . '("' . $label . '","' . $column . '",["table"=>"' . $optionTable . '","value_option"=>"' . $optionValue . '","display_option"=>"' . $optionDisplay . '","sql_condition"=>"' . $optionSqlCondition . '"])' . $required . $indexShow . $detailShow . $addShow . $editShow . $help . ';' . "\n\t\t"; |
86 | 86 | } |
87 | - }elseif ($field['column_type'] == "select_query") { |
|
87 | + } elseif ($field['column_type'] == "select_query") { |
|
88 | 88 | if($sqlRawQuery && Str::contains($sqlRawQuery,["as `key`","as `label`"])) { |
89 | 89 | $scaffold .= '$this->add' . $methodName . '("' . $label . '","' . $column . '","'.$sqlRawQuery.'")' . $required . $indexShow . $detailShow . $addShow . $editShow . $help . ';' . "\n\t\t"; |
90 | 90 | } |
91 | - }else{ |
|
91 | + } else{ |
|
92 | 92 | $scaffold .= '$this->add'.$methodName.'("'.$label.'","'.$column.'")'.$required.$indexShow.$detailShow.$addShow.$editShow.$help.';'."\n\t\t"; |
93 | 93 | } |
94 | 94 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | if($moduleData = DB::table("cb_modules")->where("name", $name)->where("table_name",$this->table)->first()) { |
115 | 115 | DB::table("cb_modules")->where("id",$moduleData->id)->update($module); |
116 | 116 | $id_modules = $moduleData->id; |
117 | - }else{ |
|
117 | + } else{ |
|
118 | 118 | $id_modules = DB::table('cb_modules')->insertGetId($module); |
119 | 119 | } |
120 | 120 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $menu['cb_modules_id'] = $id_modules; |
126 | 126 | if(isset($moduleData)) { |
127 | 127 | DB::table("cb_menus")->where("cb_modules_id",$moduleData->id)->update($menu); |
128 | - }else{ |
|
128 | + } else{ |
|
129 | 129 | DB::table('cb_menus')->insertGetId($menu); |
130 | 130 | } |
131 | 131 |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $newLocation = $pathWithoutName.'/w_'.$width.'_h_'.$height.'_'.$basename; |
177 | 177 | if(Storage::exists($newLocation)) { |
178 | 178 | return asset($newLocation); |
179 | - }else{ |
|
179 | + } else{ |
|
180 | 180 | $img = Image::make(storage_path($path))->fit($width,$height); |
181 | 181 | $img->save(storage_path($newLocation),$quality); |
182 | 182 | return asset($newLocation); |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | $settings = file_get_contents(storage_path('.cbconfig')); |
224 | 224 | $settings = decrypt($settings); |
225 | 225 | $settings = unserialize($settings); |
226 | - }else{ |
|
226 | + } else{ |
|
227 | 227 | $settings = []; |
228 | 228 | } |
229 | 229 | |
@@ -242,13 +242,13 @@ discard block |
||
242 | 242 | $settings = file_get_contents(storage_path('.cbconfig')); |
243 | 243 | $settings = decrypt($settings); |
244 | 244 | $settings = unserialize($settings); |
245 | - }else{ |
|
245 | + } else{ |
|
246 | 246 | $settings = []; |
247 | 247 | } |
248 | 248 | |
249 | 249 | if(isset($settings[$key])) { |
250 | 250 | return $settings[$key]?:$default; |
251 | - }else{ |
|
251 | + } else{ |
|
252 | 252 | return $default; |
253 | 253 | } |
254 | 254 | } |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | $url = request($name); |
335 | 335 | if(filter_var($url, FILTER_VALIDATE_URL)) { |
336 | 336 | return $url; |
337 | - }else{ |
|
337 | + } else{ |
|
338 | 338 | return request()->url(); |
339 | 339 | } |
340 | 340 | } |
@@ -346,14 +346,14 @@ discard block |
||
346 | 346 | $response = request($name); |
347 | 347 | if(is_string($response)) { |
348 | 348 | $response = sanitizeXSS($response); |
349 | - }elseif (is_array($response)) { |
|
349 | + } elseif (is_array($response)) { |
|
350 | 350 | array_walk_recursive($response, function(&$response) { |
351 | 351 | $response = sanitizeXSS($response); |
352 | 352 | }); |
353 | 353 | } |
354 | 354 | |
355 | 355 | return $response; |
356 | - }else{ |
|
356 | + } else{ |
|
357 | 357 | return Request::get($name); |
358 | 358 | } |
359 | 359 | } |
@@ -363,11 +363,13 @@ discard block |
||
363 | 363 | function min_var_export($input) { |
364 | 364 | if(is_array($input)) { |
365 | 365 | $buffer = []; |
366 | - foreach($input as $key => $value) |
|
367 | - $buffer[] = var_export($key, true)."=>".min_var_export($value); |
|
366 | + foreach($input as $key => $value) { |
|
367 | + $buffer[] = var_export($key, true)."=>".min_var_export($value); |
|
368 | + } |
|
368 | 369 | return "[".implode(",",$buffer)."]"; |
369 | - } else |
|
370 | - return var_export($input, true); |
|
370 | + } else { |
|
371 | + return var_export($input, true); |
|
372 | + } |
|
371 | 373 | } |
372 | 374 | } |
373 | 375 | |
@@ -380,10 +382,11 @@ discard block |
||
380 | 382 | $objects = scandir($dir); |
381 | 383 | foreach ($objects as $object) { |
382 | 384 | if ($object != "." && $object != "..") { |
383 | - if (is_dir($dir."/".$object)) |
|
384 | - rrmdir($dir."/".$object); |
|
385 | - else |
|
386 | - unlink($dir."/".$object); |
|
385 | + if (is_dir($dir."/".$object)) { |
|
386 | + rrmdir($dir."/".$object); |
|
387 | + } else { |
|
388 | + unlink($dir."/".$object); |
|
389 | + } |
|
387 | 390 | } |
388 | 391 | } |
389 | 392 | rmdir($dir); |
@@ -23,16 +23,17 @@ |
||
23 | 23 | |
24 | 24 | public function create() |
25 | 25 | { |
26 | - if($this->command->) |
|
27 | - if($this->command->option("password") == "AUTO") { |
|
26 | + if($this->command->) { |
|
27 | + if($this->command->option("password") == "AUTO") { |
|
28 | 28 | $password = Str::random(16); |
29 | - }else{ |
|
29 | + } |
|
30 | + } else{ |
|
30 | 31 | $password = $this->command->option("password"); |
31 | 32 | } |
32 | 33 | |
33 | 34 | if($this->command->option("username") == "AUTO") { |
34 | 35 | $username = Str::random(5); |
35 | - }else{ |
|
36 | + } else{ |
|
36 | 37 | $username = $this->command->option("username"); |
37 | 38 | } |
38 | 39 |
@@ -24,7 +24,7 @@ |
||
24 | 24 | foreach($data_options as $key=>$option) { |
25 | 25 | if(is_int($key)) { |
26 | 26 | $data_options[$option] = $option; |
27 | - }else{ |
|
27 | + } else{ |
|
28 | 28 | $data_options[$key] = $option; |
29 | 29 | } |
30 | 30 | } |
@@ -31,7 +31,7 @@ |
||
31 | 31 | |
32 | 32 | if(is_callable($query)) { |
33 | 33 | $result = call_user_func($query); |
34 | - }else{ |
|
34 | + } else{ |
|
35 | 35 | $result = DB::select(DB::raw($query)); |
36 | 36 | } |
37 | 37 |