@@ -26,17 +26,17 @@ discard block |
||
26 | 26 | try { |
27 | 27 | $routeArray = request()->route()->getAction(); |
28 | 28 | $this->controller = class_basename($routeArray['controller']); |
29 | - $this->controller = strtok($this->controller,"@"); |
|
29 | + $this->controller = strtok($this->controller, "@"); |
|
30 | 30 | |
31 | 31 | $className = "\\".$routeArray["namespace"]."\\".$this->controller; |
32 | - if(class_exists($className)) { |
|
33 | - $this->module = cb()->find("cb_modules",["controller"=>$this->controller]); |
|
34 | - if($this->module) { |
|
32 | + if (class_exists($className)) { |
|
33 | + $this->module = cb()->find("cb_modules", ["controller"=>$this->controller]); |
|
34 | + if ($this->module) { |
|
35 | 35 | $this->controller_class = new $className(); |
36 | - $this->menu = cb()->find("cb_menus",["cb_modules_id"=>$this->module->id]); |
|
37 | - $this->menu = (!$this->menu)?cb()->find("cb_menus",["type"=>"path","path"=>request()->segment(2)]):$this->menu; |
|
38 | - if($this->menu) { |
|
39 | - $this->privilege = cb()->find("cb_role_privileges",[ |
|
36 | + $this->menu = cb()->find("cb_menus", ["cb_modules_id"=>$this->module->id]); |
|
37 | + $this->menu = (!$this->menu) ?cb()->find("cb_menus", ["type"=>"path", "path"=>request()->segment(2)]) : $this->menu; |
|
38 | + if ($this->menu) { |
|
39 | + $this->privilege = cb()->find("cb_role_privileges", [ |
|
40 | 40 | "cb_menus_id"=>$this->menu->id, |
41 | 41 | "cb_roles_id"=>cb()->session()->roleId() |
42 | 42 | ]); |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | public function getData($key) { |
60 | - if($this->controller_class) { |
|
60 | + if ($this->controller_class) { |
|
61 | 61 | $value = $this->controller_class->getData($key); |
62 | - if(isset($value)) { |
|
62 | + if (isset($value)) { |
|
63 | 63 | return $value; |
64 | 64 | } |
65 | 65 | } |
@@ -70,128 +70,128 @@ discard block |
||
70 | 70 | * @return CBController |
71 | 71 | */ |
72 | 72 | public function getController() { |
73 | - return ($this->controller_class)?$this->controller_class:null; |
|
73 | + return ($this->controller_class) ? $this->controller_class : null; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | public function getPageTitle() |
77 | 77 | { |
78 | - return ($this->controller_class)?$this->controller_class->getData("page_title")?:cb()->getAppName():null; |
|
78 | + return ($this->controller_class) ? $this->controller_class->getData("page_title") ?: cb()->getAppName() : null; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | public function getTable() |
82 | 82 | { |
83 | - return ($this->controller_class)?$this->controller_class->getData("table"):null; |
|
83 | + return ($this->controller_class) ? $this->controller_class->getData("table") : null; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | public function getPageIcon() |
87 | 87 | { |
88 | - return ($this->controller_class)?$this->controller_class->getData('page_icon')?:"fa fa-bars":null; |
|
88 | + return ($this->controller_class) ? $this->controller_class->getData('page_icon') ?: "fa fa-bars" : null; |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | public function canBrowse() { |
92 | - if($this->privilege) { |
|
93 | - if($this->privilege->can_browse) return true; |
|
92 | + if ($this->privilege) { |
|
93 | + if ($this->privilege->can_browse) return true; |
|
94 | 94 | else return false; |
95 | - }else{ |
|
95 | + } else { |
|
96 | 96 | return true; |
97 | 97 | } |
98 | 98 | } |
99 | 99 | |
100 | 100 | public function canCreate() { |
101 | - if($this->privilege) { |
|
102 | - if($this->privilege->can_create) return true; |
|
101 | + if ($this->privilege) { |
|
102 | + if ($this->privilege->can_create) return true; |
|
103 | 103 | else return false; |
104 | - }else{ |
|
104 | + } else { |
|
105 | 105 | return true; |
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
109 | 109 | public function canRead() { |
110 | - if($this->privilege) { |
|
111 | - if($this->privilege->can_read) return true; |
|
110 | + if ($this->privilege) { |
|
111 | + if ($this->privilege->can_read) return true; |
|
112 | 112 | else return false; |
113 | - }else{ |
|
113 | + } else { |
|
114 | 114 | return true; |
115 | 115 | } |
116 | 116 | } |
117 | 117 | |
118 | 118 | public function canUpdate() { |
119 | - if($this->privilege) { |
|
120 | - if($this->privilege->can_update) return true; |
|
119 | + if ($this->privilege) { |
|
120 | + if ($this->privilege->can_update) return true; |
|
121 | 121 | else return false; |
122 | - }else{ |
|
122 | + } else { |
|
123 | 123 | return true; |
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
127 | 127 | public function canDelete() { |
128 | - if($this->privilege) { |
|
129 | - if($this->privilege->can_delete) return true; |
|
128 | + if ($this->privilege) { |
|
129 | + if ($this->privilege->can_delete) return true; |
|
130 | 130 | else return false; |
131 | - }else{ |
|
131 | + } else { |
|
132 | 132 | return true; |
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
136 | 136 | public function addURL() |
137 | 137 | { |
138 | - if($this->controller_class && method_exists($this->controller_class, 'getAdd')) { |
|
138 | + if ($this->controller_class && method_exists($this->controller_class, 'getAdd')) { |
|
139 | 139 | return action($this->controller.'@getAdd'); |
140 | - }else{ |
|
140 | + } else { |
|
141 | 141 | return null; |
142 | 142 | } |
143 | 143 | } |
144 | 144 | |
145 | 145 | public function addSaveURL() |
146 | 146 | { |
147 | - if($this->controller_class && method_exists($this->controller_class, 'postAddSave')) { |
|
147 | + if ($this->controller_class && method_exists($this->controller_class, 'postAddSave')) { |
|
148 | 148 | return action($this->controller.'@postAddSave'); |
149 | - }else{ |
|
149 | + } else { |
|
150 | 150 | return null; |
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
154 | 154 | public function editURL($id = null) |
155 | 155 | { |
156 | - if($this->controller_class && method_exists($this->controller_class, 'getEdit')) { |
|
156 | + if ($this->controller_class && method_exists($this->controller_class, 'getEdit')) { |
|
157 | 157 | return action($this->controller.'@getEdit')."/".$id; |
158 | - }else{ |
|
158 | + } else { |
|
159 | 159 | return null; |
160 | 160 | } |
161 | 161 | } |
162 | 162 | |
163 | 163 | public function editSaveURL($id = null) |
164 | 164 | { |
165 | - if(method_exists($this->controller_class, 'postEditSave')) { |
|
165 | + if (method_exists($this->controller_class, 'postEditSave')) { |
|
166 | 166 | return action($this->controller.'@postEditSave')."/".$id; |
167 | - }else{ |
|
167 | + } else { |
|
168 | 168 | return null; |
169 | 169 | } |
170 | 170 | } |
171 | 171 | |
172 | - public function detailURL($id=null) |
|
172 | + public function detailURL($id = null) |
|
173 | 173 | { |
174 | - if($this->controller_class && method_exists($this->controller_class, 'getDetail')) { |
|
174 | + if ($this->controller_class && method_exists($this->controller_class, 'getDetail')) { |
|
175 | 175 | return action($this->controller.'@getDetail')."/".$id; |
176 | - }else{ |
|
176 | + } else { |
|
177 | 177 | return null; |
178 | 178 | } |
179 | 179 | } |
180 | 180 | |
181 | - public function deleteURL($id=null) |
|
181 | + public function deleteURL($id = null) |
|
182 | 182 | { |
183 | - if($this->controller_class && method_exists($this->controller_class, 'getDelete')) { |
|
183 | + if ($this->controller_class && method_exists($this->controller_class, 'getDelete')) { |
|
184 | 184 | return action($this->controller.'@getDelete')."/".$id; |
185 | - }else{ |
|
185 | + } else { |
|
186 | 186 | return null; |
187 | 187 | } |
188 | 188 | } |
189 | 189 | |
190 | 190 | public function url($path = null) |
191 | 191 | { |
192 | - if($this->controller_class && method_exists($this->controller_class, 'getIndex')) { |
|
193 | - return trim(action($this->controller.'@getIndex').'/'.$path,'/'); |
|
194 | - }else{ |
|
192 | + if ($this->controller_class && method_exists($this->controller_class, 'getIndex')) { |
|
193 | + return trim(action($this->controller.'@getIndex').'/'.$path, '/'); |
|
194 | + } else { |
|
195 | 195 | return null; |
196 | 196 | } |
197 | 197 | } |
@@ -25,13 +25,13 @@ discard block |
||
25 | 25 | |
26 | 26 | $query->addSelect($this->data['table'].'.'.cb()->pk($this->data['table']).' as primary_key'); |
27 | 27 | |
28 | - $softDelete = isset($this->data['disable_soft_delete'])?$this->data['disable_soft_delete']:true; |
|
29 | - if($softDelete === true && SchemaHelper::hasColumn($this->data['table'],'deleted_at')) { |
|
28 | + $softDelete = isset($this->data['disable_soft_delete']) ? $this->data['disable_soft_delete'] : true; |
|
29 | + if ($softDelete === true && SchemaHelper::hasColumn($this->data['table'], 'deleted_at')) { |
|
30 | 30 | $query->whereNull($this->data['table'].'.deleted_at'); |
31 | 31 | } |
32 | 32 | |
33 | - if(isset($joins)) { |
|
34 | - foreach($joins as $join) |
|
33 | + if (isset($joins)) { |
|
34 | + foreach ($joins as $join) |
|
35 | 35 | { |
36 | 36 | $query->join($join['target_table'], |
37 | 37 | $join['target_table_primary'], |
@@ -41,14 +41,14 @@ discard block |
||
41 | 41 | } |
42 | 42 | } |
43 | 43 | |
44 | - foreach($columns as $column) { |
|
44 | + foreach ($columns as $column) { |
|
45 | 45 | /** @var ColumnModel $column */ |
46 | - if($column->getType() != "custom") { |
|
47 | - if(strpos($column->getField(),".") === false) { |
|
48 | - if(SchemaHelper::hasColumn($this->data['table'], $column->getField())) { |
|
46 | + if ($column->getType() != "custom") { |
|
47 | + if (strpos($column->getField(), ".") === false) { |
|
48 | + if (SchemaHelper::hasColumn($this->data['table'], $column->getField())) { |
|
49 | 49 | $query->addSelect($this->data['table'].'.'.$column->getField()); |
50 | 50 | } |
51 | - }else{ |
|
51 | + } else { |
|
52 | 52 | $query->addSelect($column->getField()); |
53 | 53 | } |
54 | 54 | } |
@@ -57,27 +57,27 @@ discard block |
||
57 | 57 | $query = getTypeHook($column->getType())->query($query, $column); |
58 | 58 | |
59 | 59 | // Filter Query From Type |
60 | - $filterValue = request("filter_".slug($column->getFilterColumn(),"_")); |
|
61 | - if(is_array($filterValue) || sanitizeXSS($filterValue)) { |
|
60 | + $filterValue = request("filter_".slug($column->getFilterColumn(), "_")); |
|
61 | + if (is_array($filterValue) || sanitizeXSS($filterValue)) { |
|
62 | 62 | $query = getTypeHook($column->getType())->filterQuery($query, $column, $filterValue); |
63 | 63 | } |
64 | 64 | } |
65 | 65 | |
66 | - if(request()->has('q')) |
|
66 | + if (request()->has('q')) |
|
67 | 67 | { |
68 | 68 | $keyword = sanitizeXSS(request("q")); |
69 | - if(isset($this->data['hook_search_query'])) { |
|
69 | + if (isset($this->data['hook_search_query'])) { |
|
70 | 70 | $query = call_user_func($this->data['hook_search_query'], $query, $keyword); |
71 | - }else{ |
|
72 | - $query->where(function ($where) use ($columns, $keyword) { |
|
71 | + } else { |
|
72 | + $query->where(function($where) use ($columns, $keyword) { |
|
73 | 73 | /** |
74 | 74 | * @var $where Builder |
75 | 75 | */ |
76 | - foreach($columns as $column) |
|
76 | + foreach ($columns as $column) |
|
77 | 77 | { |
78 | - if(strpos($column->getField(),".") === false) { |
|
78 | + if (strpos($column->getField(), ".") === false) { |
|
79 | 79 | $field = $this->data['table'].'.'.$column->getField(); |
80 | - }else{ |
|
80 | + } else { |
|
81 | 81 | $field = $column->getField(); |
82 | 82 | } |
83 | 83 | $where->orWhere($field, 'like', '%'.$keyword.'%'); |
@@ -90,36 +90,36 @@ discard block |
||
90 | 90 | /* |
91 | 91 | * This script to hanlde the callback inputed on this query method |
92 | 92 | */ |
93 | - if(isset($callback) && is_callable($callback)) { |
|
93 | + if (isset($callback) && is_callable($callback)) { |
|
94 | 94 | $query = call_user_func($callback, $query); |
95 | 95 | } |
96 | 96 | |
97 | - if(isset($this->data['hook_index_query']) && is_callable($this->data['hook_index_query'])) { |
|
97 | + if (isset($this->data['hook_index_query']) && is_callable($this->data['hook_index_query'])) { |
|
98 | 98 | $query = call_user_func($this->data['hook_index_query'], $query); |
99 | 99 | } |
100 | 100 | |
101 | 101 | |
102 | - if(request()->has(['order_by','order_sort'])) |
|
102 | + if (request()->has(['order_by', 'order_sort'])) |
|
103 | 103 | { |
104 | - $sort = (request("order_sort")=="asc")?"asc":"desc"; |
|
104 | + $sort = (request("order_sort") == "asc") ? "asc" : "desc"; |
|
105 | 105 | /* |
106 | 106 | * Check if order by contain "." it means {table}.{column} we have to parsing that |
107 | 107 | */ |
108 | - if(strpos(request("order_by"), ".")!==false) { |
|
109 | - $orderByTable = explode(".",request("order_by"))[0]; |
|
110 | - $orderByColumn = explode(".",request("order_by"))[1]; |
|
111 | - if(SchemaHelper::hasColumn($orderByTable, $orderByColumn)) { |
|
108 | + if (strpos(request("order_by"), ".") !== false) { |
|
109 | + $orderByTable = explode(".", request("order_by"))[0]; |
|
110 | + $orderByColumn = explode(".", request("order_by"))[1]; |
|
111 | + if (SchemaHelper::hasColumn($orderByTable, $orderByColumn)) { |
|
112 | 112 | $query->orderBy($orderByTable.".".$orderByColumn, $sort); |
113 | 113 | } |
114 | 114 | } else { |
115 | 115 | /* |
116 | 116 | * Check if order_by column in registered columns |
117 | 117 | */ |
118 | - if(in_array(request('order_by'),columnSingleton()->getColumnNameOnly())) { |
|
118 | + if (in_array(request('order_by'), columnSingleton()->getColumnNameOnly())) { |
|
119 | 119 | $query->orderBy(request('order_by'), request('order_sort')); |
120 | 120 | } |
121 | 121 | } |
122 | - }else{ |
|
122 | + } else { |
|
123 | 123 | /* |
124 | 124 | * For default, query will be order by primary key as descending |
125 | 125 | */ |
@@ -31,25 +31,25 @@ discard block |
||
31 | 31 | |
32 | 32 | public function getIndex() { |
33 | 33 | |
34 | - if(request("refresh")) { |
|
35 | - $this->fetchPluginData(false ); |
|
36 | - return cb()->redirectBack("Plugin list has been refreshed!","success"); |
|
34 | + if (request("refresh")) { |
|
35 | + $this->fetchPluginData(false); |
|
36 | + return cb()->redirectBack("Plugin list has been refreshed!", "success"); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | $data = []; |
40 | 40 | $data['result'] = $this->fetchPluginData(); |
41 | - return view($this->view.'.index',$data); |
|
41 | + return view($this->view.'.index', $data); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | public function getUninstall($key) |
45 | 45 | { |
46 | 46 | $pluginData = $this->fetchPluginData(); |
47 | 47 | |
48 | - if(isset($pluginData[$key])) { |
|
49 | - if(file_exists(app_path("CBPlugins/".$key))) { |
|
48 | + if (isset($pluginData[$key])) { |
|
49 | + if (file_exists(app_path("CBPlugins/".$key))) { |
|
50 | 50 | |
51 | - if(isset($pluginData['source']) && $pluginData['source'] == 'composer') { |
|
52 | - if(isset($pluginData['package'])) { |
|
51 | + if (isset($pluginData['source']) && $pluginData['source'] == 'composer') { |
|
52 | + if (isset($pluginData['package'])) { |
|
53 | 53 | ComposerHelper::composerRemove($pluginData['package']); |
54 | 54 | } |
55 | 55 | } |
@@ -57,24 +57,24 @@ discard block |
||
57 | 57 | rrmdir(app_path("CBPlugins/".$key)); |
58 | 58 | |
59 | 59 | return response()->json(['status'=>true, 'message'=>'Plugin has been uninstalled!']); |
60 | - }else{ |
|
61 | - return response()->json(['status'=>false,'message'=>'Failed to uninstall, plugin is not found']); |
|
60 | + } else { |
|
61 | + return response()->json(['status'=>false, 'message'=>'Failed to uninstall, plugin is not found']); |
|
62 | 62 | } |
63 | - }else { |
|
64 | - return response()->json(['status'=>false,'message'=>'Failed to uninstall, plugin key is not found']); |
|
63 | + } else { |
|
64 | + return response()->json(['status'=>false, 'message'=>'Failed to uninstall, plugin key is not found']); |
|
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
68 | - private function recursiveCopy($src,$dst) { |
|
68 | + private function recursiveCopy($src, $dst) { |
|
69 | 69 | $dir = opendir($src); |
70 | 70 | @mkdir($dst); |
71 | - while(false !== ( $file = readdir($dir)) ) { |
|
72 | - if (( $file != '.' ) && ( $file != '..' )) { |
|
73 | - if ( is_dir($src . '/' . $file) ) { |
|
74 | - $this->recursiveCopy($src . '/' . $file,$dst . '/' . $file); |
|
71 | + while (false !== ($file = readdir($dir))) { |
|
72 | + if (($file != '.') && ($file != '..')) { |
|
73 | + if (is_dir($src.'/'.$file)) { |
|
74 | + $this->recursiveCopy($src.'/'.$file, $dst.'/'.$file); |
|
75 | 75 | } |
76 | 76 | else { |
77 | - copy($src . '/' . $file,$dst . '/' . $file); |
|
77 | + copy($src.'/'.$file, $dst.'/'.$file); |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | } |
@@ -83,26 +83,26 @@ discard block |
||
83 | 83 | |
84 | 84 | public function getInstall($key) |
85 | 85 | { |
86 | - ini_set("memory_limit","192M"); |
|
86 | + ini_set("memory_limit", "192M"); |
|
87 | 87 | set_time_limit(500); |
88 | 88 | |
89 | 89 | $pluginData = $this->fetchPluginData(); |
90 | 90 | |
91 | 91 | try { |
92 | - if(isset($pluginData[$key])) { |
|
92 | + if (isset($pluginData[$key])) { |
|
93 | 93 | $plugin = $pluginData[$key]; |
94 | 94 | |
95 | - if(isset($plugin['source']) && $plugin['source'] == "composer") { |
|
95 | + if (isset($plugin['source']) && $plugin['source'] == "composer") { |
|
96 | 96 | |
97 | - if(isset($plugin['package']) && isset($plugin['service_provider'])) { |
|
97 | + if (isset($plugin['package']) && isset($plugin['service_provider'])) { |
|
98 | 98 | // Make a composer |
99 | 99 | $output = ComposerHelper::composerRequire($plugin['package'], $plugin['service_provider']); |
100 | 100 | |
101 | 101 | Artisan::call("migrate"); |
102 | 102 | |
103 | - return response()->json(['status'=>true,'message'=>$output]); |
|
103 | + return response()->json(['status'=>true, 'message'=>$output]); |
|
104 | 104 | } else { |
105 | - return response()->json(['status'=>true,'message'=>'Installation is failed, there is no package and or service provider']); |
|
105 | + return response()->json(['status'=>true, 'message'=>'Installation is failed, there is no package and or service provider']); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | } else { |
@@ -121,16 +121,16 @@ discard block |
||
121 | 121 | fclose($temp); |
122 | 122 | |
123 | 123 | // Rename |
124 | - if(file_exists(app_path("CBPlugins/".$key))) rrmdir(app_path("CBPlugins/".$key)); |
|
124 | + if (file_exists(app_path("CBPlugins/".$key))) rrmdir(app_path("CBPlugins/".$key)); |
|
125 | 125 | rename(app_path("CBPlugins/".$dirName), app_path("CBPlugins/".$key)); |
126 | 126 | |
127 | 127 | // Read Plugin JSON |
128 | 128 | $pluginJson = json_decode(file_get_contents(app_path("CBPlugins/".$key."/plugin.json")), true); |
129 | 129 | |
130 | 130 | // Check if has asset |
131 | - if($pluginJson && $pluginJson['asset']) { |
|
131 | + if ($pluginJson && $pluginJson['asset']) { |
|
132 | 132 | // Check destination folder is ready |
133 | - if(file_exists(public_path("cb_asset/".$key))) { |
|
133 | + if (file_exists(public_path("cb_asset/".$key))) { |
|
134 | 134 | rrmdir(public_path("cb_asset/".$key)); |
135 | 135 | } |
136 | 136 | |
@@ -144,31 +144,31 @@ discard block |
||
144 | 144 | //Migrate |
145 | 145 | Artisan::call("migrate"); |
146 | 146 | |
147 | - return response()->json(['status'=>true,'message'=>'Install / update plugin has been succesfull!']); |
|
147 | + return response()->json(['status'=>true, 'message'=>'Install / update plugin has been succesfull!']); |
|
148 | 148 | |
149 | 149 | } else { |
150 | - return response()->json(['status'=>false,'message'=>"Failed to install/update, can't open the plugin archive"]); |
|
150 | + return response()->json(['status'=>false, 'message'=>"Failed to install/update, can't open the plugin archive"]); |
|
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
154 | - }else{ |
|
155 | - return response()->json(['status'=>false,'message'=>'Failed to install/update, plugin key is not found']); |
|
154 | + } else { |
|
155 | + return response()->json(['status'=>false, 'message'=>'Failed to install/update, plugin key is not found']); |
|
156 | 156 | } |
157 | 157 | } catch (\Exception $e) { |
158 | - return response()->json(['status'=>false,'message'=>'Something went wrong!']); |
|
158 | + return response()->json(['status'=>false, 'message'=>'Something went wrong!']); |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | |
162 | 162 | private function fetchPluginData($cache = true) |
163 | 163 | { |
164 | - if($cache === true && $data = Cache::get("plugin_store_data")) { |
|
164 | + if ($cache === true && $data = Cache::get("plugin_store_data")) { |
|
165 | 165 | return $data; |
166 | 166 | } |
167 | 167 | |
168 | 168 | $result = []; |
169 | 169 | |
170 | 170 | try { |
171 | - $no_cache = ($cache)?0:1; |
|
171 | + $no_cache = ($cache) ? 0 : 1; |
|
172 | 172 | $opts = [ |
173 | 173 | "http" => [ |
174 | 174 | "method" => "GET", |
@@ -181,13 +181,13 @@ discard block |
||
181 | 181 | $context = stream_context_create($opts); |
182 | 182 | $data = file_get_contents(base64_decode("aHR0cDovL2NydWRib29zdGVyLmNvbS9hcGkvcGx1Z2luP2FjY2Vzc190b2tlbj1iVmMvWm5wWU5TWnJNVlpZT0hFNVUydHFjU1U9"), false, $context); |
183 | 183 | |
184 | - if($data) { |
|
184 | + if ($data) { |
|
185 | 185 | $data = json_decode($data, true); |
186 | - if($data['status']==true) { |
|
186 | + if ($data['status'] == true) { |
|
187 | 187 | |
188 | - foreach($data['data'] as $item) { |
|
188 | + foreach ($data['data'] as $item) { |
|
189 | 189 | $key = $item['key']; |
190 | - $result[ $key ] = $item; |
|
190 | + $result[$key] = $item; |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | $result = collect($result)->sortBy("name")->all(); |