@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | /** |
16 | 16 | * @var $type |
17 | 17 | */ |
18 | - public $type='migration'; |
|
18 | + public $type = 'migration'; |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * @var array |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | /** |
34 | 34 | * @var $commandRule |
35 | 35 | */ |
36 | - public $commandRule=['create'=>[ |
|
37 | - 'name','table' |
|
36 | + public $commandRule = ['create'=>[ |
|
37 | + 'name', 'table' |
|
38 | 38 | ], |
39 | 39 | 'push'=>[]]; |
40 | 40 | |
@@ -63,14 +63,14 @@ discard block |
||
63 | 63 | |
64 | 64 | foreach ($pushResult as $key=>$value) { |
65 | 65 | |
66 | - if(isset($value['success'])){ |
|
66 | + if (isset($value['success'])) { |
|
67 | 67 | |
68 | 68 | $list[] = true; |
69 | 69 | |
70 | - $pushResultFile = explode("/",$pushResult[$key]['file']); |
|
70 | + $pushResultFile = explode("/", $pushResult[$key]['file']); |
|
71 | 71 | $file = end($pushResultFile); |
72 | 72 | |
73 | - if($pushResult[$key]['success']===true){ |
|
73 | + if ($pushResult[$key]['success']===true) { |
|
74 | 74 | |
75 | 75 | $this->table->addRow([ |
76 | 76 | $key, |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | 'No', |
83 | 83 | ]); |
84 | 84 | } |
85 | - else{ |
|
85 | + else { |
|
86 | 86 | |
87 | 87 | $this->table->addRow([ |
88 | 88 | $key, |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
101 | - if(count($list)){ |
|
102 | - $this->table->setHeaders(['id','table','file','type','status','message','seeder']); |
|
101 | + if (count($list)) { |
|
102 | + $this->table->setHeaders(['id', 'table', 'file', 'type', 'status', 'message', 'seeder']); |
|
103 | 103 | |
104 | 104 | echo $this->table->getTable(); |
105 | 105 | } |
106 | - else{ |
|
106 | + else { |
|
107 | 107 | echo $this->classical('No migration was found to apply'); |
108 | 108 | } |
109 | 109 | |
@@ -117,10 +117,10 @@ discard block |
||
117 | 117 | { |
118 | 118 | $config = $this->getConfig(); |
119 | 119 | |
120 | - if(!isset($this->argument['group'])){ |
|
120 | + if (!isset($this->argument['group'])) { |
|
121 | 121 | $path = $config['paths'][0]; |
122 | 122 | } |
123 | - else{ |
|
123 | + else { |
|
124 | 124 | $path = $config['paths'][strtolower($this->argument['group'])]; |
125 | 125 | } |
126 | 126 | |
@@ -130,19 +130,19 @@ discard block |
||
130 | 130 | |
131 | 131 | $stubType = (!file_exists($tablePath)) ? 'create' : 'alter'; |
132 | 132 | |
133 | - if(!file_exists($path)){ |
|
133 | + if (!file_exists($path)) { |
|
134 | 134 | |
135 | - $this->file->fs->mkdir($path,0777); |
|
136 | - $this->file->fs->chmod($path,0777,000,true); |
|
135 | + $this->file->fs->mkdir($path, 0777); |
|
136 | + $this->file->fs->chmod($path, 0777, 000, true); |
|
137 | 137 | } |
138 | 138 | |
139 | - $migrationCreate = $this->getSchema()->stub($this->argument,$stubType); |
|
139 | + $migrationCreate = $this->getSchema()->stub($this->argument, $stubType); |
|
140 | 140 | |
141 | 141 | echo $this->info('Migration Create Process :'); |
142 | 142 | |
143 | - $this->table->setHeaders(['id','method','table','style','name','type','status','message']); |
|
143 | + $this->table->setHeaders(['id', 'method', 'table', 'style', 'name', 'type', 'status', 'message']); |
|
144 | 144 | |
145 | - foreach ($migrationCreate['directory'] as $key=>$data){ |
|
145 | + foreach ($migrationCreate['directory'] as $key=>$data) { |
|
146 | 146 | |
147 | 147 | $this->table->addRow([ |
148 | 148 | $key, |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | ]); |
158 | 158 | } |
159 | 159 | |
160 | - foreach ($migrationCreate['file'] as $key=>$data){ |
|
160 | + foreach ($migrationCreate['file'] as $key=>$data) { |
|
161 | 161 | |
162 | 162 | $this->table->addRow([ |
163 | 163 | $key, |
@@ -188,13 +188,13 @@ discard block |
||
188 | 188 | 'arguments' => $this->argument |
189 | 189 | ]; |
190 | 190 | |
191 | - $paths['paths'] = array_merge($paths['paths'],[StaticPathModel::storeMigrationPath()]); |
|
191 | + $paths['paths'] = array_merge($paths['paths'], [StaticPathModel::storeMigrationPath()]); |
|
192 | 192 | |
193 | 193 | foreach (config('database.migrations') as $key=>$item) { |
194 | - if($key!=='default'){ |
|
194 | + if ($key!=='default') { |
|
195 | 195 | |
196 | 196 | $otherMigrationPath = path()->migration().''.$item; |
197 | - $paths['paths'] = array_merge($paths['paths'],[$key=>$otherMigrationPath]); |
|
197 | + $paths['paths'] = array_merge($paths['paths'], [$key=>$otherMigrationPath]); |
|
198 | 198 | } |
199 | 199 | } |
200 | 200 |
@@ -81,8 +81,7 @@ discard block |
||
81 | 81 | 'Ok', |
82 | 82 | 'No', |
83 | 83 | ]); |
84 | - } |
|
85 | - else{ |
|
84 | + } else{ |
|
86 | 85 | |
87 | 86 | $this->table->addRow([ |
88 | 87 | $key, |
@@ -102,8 +101,7 @@ discard block |
||
102 | 101 | $this->table->setHeaders(['id','table','file','type','status','message','seeder']); |
103 | 102 | |
104 | 103 | echo $this->table->getTable(); |
105 | - } |
|
106 | - else{ |
|
104 | + } else{ |
|
107 | 105 | echo $this->classical('No migration was found to apply'); |
108 | 106 | } |
109 | 107 | |
@@ -119,8 +117,7 @@ discard block |
||
119 | 117 | |
120 | 118 | if(!isset($this->argument['group'])){ |
121 | 119 | $path = $config['paths'][0]; |
122 | - } |
|
123 | - else{ |
|
120 | + } else{ |
|
124 | 121 | $path = $config['paths'][strtolower($this->argument['group'])]; |
125 | 122 | } |
126 | 123 |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | */ |
15 | 15 | public function get() |
16 | 16 | { |
17 | - if(!isset($this->config['paths'][0])){ |
|
17 | + if (!isset($this->config['paths'][0])) { |
|
18 | 18 | exit(); |
19 | 19 | } |
20 | 20 | |
@@ -27,11 +27,11 @@ discard block |
||
27 | 27 | |
28 | 28 | $list = []; |
29 | 29 | |
30 | - foreach ($migrations as $table=>$item){ |
|
30 | + foreach ($migrations as $table=>$item) { |
|
31 | 31 | $list[] = strtolower($table); |
32 | 32 | } |
33 | 33 | |
34 | - if(isset($arguments['only'])){ |
|
34 | + if (isset($arguments['only'])) { |
|
35 | 35 | $dbtables = $this->getOnly($dbtables); |
36 | 36 | } |
37 | 37 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | echo 'Toplam : '.count($dbtables).' Table'; |
41 | 41 | echo PHP_EOL; |
42 | 42 | |
43 | - foreach ($dbtables as $dbtablekey=>$dbtable){ |
|
43 | + foreach ($dbtables as $dbtablekey=>$dbtable) { |
|
44 | 44 | |
45 | 45 | $dbtablekey = $dbtablekey+1; |
46 | 46 | |
@@ -49,42 +49,42 @@ discard block |
||
49 | 49 | $dbtable = ucfirst($dbtable); |
50 | 50 | $makeDirectory = $directory.''.DIRECTORY_SEPARATOR.''.$dbtable; |
51 | 51 | |
52 | - if(!file_exists($makeDirectory)){ |
|
53 | - files()->makeDirectory($makeDirectory,0755,true); |
|
54 | - $exist=false; |
|
52 | + if (!file_exists($makeDirectory)) { |
|
53 | + files()->makeDirectory($makeDirectory, 0755, true); |
|
54 | + $exist = false; |
|
55 | 55 | } |
56 | - else{ |
|
57 | - $exist=true; |
|
56 | + else { |
|
57 | + $exist = true; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | $migrationName = time().'_'.$dbtable.''; |
61 | 61 | |
62 | - if($exist===false){ |
|
62 | + if ($exist===false) { |
|
63 | 63 | |
64 | - $content = $this->getContentFile($this->getStubPath().''.DIRECTORY_SEPARATOR.'pullCreate.stub',[ |
|
64 | + $content = $this->getContentFile($this->getStubPath().''.DIRECTORY_SEPARATOR.'pullCreate.stub', [ |
|
65 | 65 | 'className' => $dbtable, |
66 | 66 | 'informations' => $informations |
67 | 67 | ]); |
68 | 68 | |
69 | - $contentResult = files()->put($makeDirectory.''.DIRECTORY_SEPARATOR.''.$migrationName.'.php',$content); |
|
69 | + $contentResult = files()->put($makeDirectory.''.DIRECTORY_SEPARATOR.''.$migrationName.'.php', $content); |
|
70 | 70 | } |
71 | 71 | |
72 | - if(substr($dbtable,-1)=='s'){ |
|
73 | - app()->command('model create','model:'.strtolower(substr($dbtable,0,-1)).' table:'.$dbtable); |
|
72 | + if (substr($dbtable, -1)=='s') { |
|
73 | + app()->command('model create', 'model:'.strtolower(substr($dbtable, 0, -1)).' table:'.$dbtable); |
|
74 | 74 | } |
75 | - else{ |
|
76 | - app()->command('model create','model:'.strtolower($dbtable).' table:'.$dbtable); |
|
75 | + else { |
|
76 | + app()->command('model create', 'model:'.strtolower($dbtable).' table:'.$dbtable); |
|
77 | 77 | } |
78 | 78 | |
79 | - if(isset($contentResult) && $contentResult!==false){ |
|
79 | + if (isset($contentResult) && $contentResult!==false) { |
|
80 | 80 | |
81 | 81 | $this->schema->getConnection()->generateEntity($dbtable); |
82 | 82 | echo $dbtablekey.'- '.$migrationName.' ---> Ok'; |
83 | 83 | } |
84 | - elseif($exist){ |
|
84 | + elseif ($exist) { |
|
85 | 85 | echo $dbtablekey.'- '.$migrationName.' ---> (Already Exist)'; |
86 | 86 | } |
87 | - else{ |
|
87 | + else { |
|
88 | 88 | echo $dbtablekey.'- '.$migrationName.' ---> Fail'; |
89 | 89 | } |
90 | 90 | |
@@ -112,46 +112,46 @@ discard block |
||
112 | 112 | |
113 | 113 | $list = []; |
114 | 114 | |
115 | - foreach ($columns as $key=>$data){ |
|
115 | + foreach ($columns as $key=>$data) { |
|
116 | 116 | |
117 | - $data['Type'] = rtrim(str_replace('unsigned','',$data['Type'])); |
|
117 | + $data['Type'] = rtrim(str_replace('unsigned', '', $data['Type'])); |
|
118 | 118 | |
119 | 119 | $field = $data['Field']; |
120 | 120 | $list[] = '$wizard->name(\''.$field.'\')'; |
121 | 121 | $list[] = '->'.$this->getColumnTransformers($data['Type']).''; |
122 | 122 | |
123 | 123 | //default block |
124 | - if(!is_null($data['Default'])){ |
|
124 | + if (!is_null($data['Default'])) { |
|
125 | 125 | $default = $data['Default']; |
126 | - $list[] = '->default(\''.$default.'\')'; |
|
126 | + $list[] = '->default(\''.$default.'\')'; |
|
127 | 127 | } |
128 | 128 | |
129 | - $getIndex = $this->getIndexInformation($indexes,$data['Field']); |
|
129 | + $getIndex = $this->getIndexInformation($indexes, $data['Field']); |
|
130 | 130 | |
131 | 131 | //unique block |
132 | - if($getIndex['Non_unique']=='0' && $getIndex['Key_name']!=='PRIMARY'){ |
|
132 | + if ($getIndex['Non_unique']=='0' && $getIndex['Key_name']!=='PRIMARY') { |
|
133 | 133 | $indexName = $getIndex['Key_name']; |
134 | - $list[] = '->unique(\''.$indexName.'\')'; |
|
134 | + $list[] = '->unique(\''.$indexName.'\')'; |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | //index block |
138 | - if($getIndex['Non_unique']=='1' && $getIndex['Key_name']!=='PRIMARY'){ |
|
138 | + if ($getIndex['Non_unique']=='1' && $getIndex['Key_name']!=='PRIMARY') { |
|
139 | 139 | $columnName = $getIndex['Column_name']; |
140 | 140 | $indexName = $getIndex['Key_name']; |
141 | 141 | |
142 | - if(count($multipleIndexes[$indexName])==1){ |
|
142 | + if (count($multipleIndexes[$indexName])==1) { |
|
143 | 143 | $list[] = '->index(\''.$indexName.'\')'; |
144 | 144 | } |
145 | 145 | } |
146 | 146 | |
147 | 147 | //comment block |
148 | - if(strlen($data['Comment'])>0){ |
|
148 | + if (strlen($data['Comment'])>0) { |
|
149 | 149 | $comment = $data['Comment']; |
150 | 150 | $list[] = '->comment(\''.$comment.'\')'; |
151 | 151 | } |
152 | 152 | |
153 | 153 | //auto increment block |
154 | - if($data['Extra']=='auto_increment'){ |
|
154 | + if ($data['Extra']=='auto_increment') { |
|
155 | 155 | $list[] = '->auto_increment()'; |
156 | 156 | } |
157 | 157 | |
@@ -166,39 +166,39 @@ discard block |
||
166 | 166 | |
167 | 167 | //table indexes |
168 | 168 | foreach ($multipleIndexes as $indexName=>$values) { |
169 | - if(count($values)>1){ |
|
170 | - $values = '\''.implode('\',\'',$values).'\''; |
|
169 | + if (count($values)>1) { |
|
170 | + $values = '\''.implode('\',\'', $values).'\''; |
|
171 | 171 | $list[] = ' $wizard->table()->indexes(\''.$indexName.'\',['.$values.']); |
172 | 172 | '; |
173 | 173 | } |
174 | 174 | } |
175 | 175 | |
176 | - if(count($foreignKeys)){ |
|
176 | + if (count($foreignKeys)) { |
|
177 | 177 | |
178 | 178 | $constraintName = $foreignKeys['CONSTRAINT_NAME']; |
179 | 179 | $key = $foreignKeys['COLUMN_NAME']; |
180 | 180 | $referenceTable = $foreignKeys['REFERENCED_TABLE_NAME']; |
181 | 181 | $referenceColumn = $foreignKeys['REFERENCED_COLUMN_NAME']; |
182 | 182 | |
183 | - if($foreignKeys['UPDATE_RULE']=='RESTRICT' && $foreignKeys['DELETE_RULE']=='RESTRICT'){ |
|
183 | + if ($foreignKeys['UPDATE_RULE']=='RESTRICT' && $foreignKeys['DELETE_RULE']=='RESTRICT') { |
|
184 | 184 | $list[] = ' $wizard->table()->foreign()->constraint(\''.$constraintName.'\')->key(\''.$key.'\')->references(\''.$referenceTable.'\',\''.$referenceColumn.'\'); |
185 | 185 | '; |
186 | 186 | } |
187 | 187 | |
188 | - if($foreignKeys['UPDATE_RULE']!=='RESTRICT' && $foreignKeys['DELETE_RULE']=='RESTRICT'){ |
|
188 | + if ($foreignKeys['UPDATE_RULE']!=='RESTRICT' && $foreignKeys['DELETE_RULE']=='RESTRICT') { |
|
189 | 189 | $rule = $foreignKeys['UPDATE_RULE']; |
190 | 190 | $list[] = ' $wizard->table()->foreign()->constraint(\''.$constraintName.'\')->key(\''.$key.'\')->references(\''.$referenceTable.'\',\''.$referenceColumn.'\')->onUpdate()->'.strtolower($rule).'(); |
191 | 191 | '; |
192 | 192 | } |
193 | 193 | |
194 | - if($foreignKeys['UPDATE_RULE']=='RESTRICT' && $foreignKeys['DELETE_RULE']!=='RESTRICT'){ |
|
194 | + if ($foreignKeys['UPDATE_RULE']=='RESTRICT' && $foreignKeys['DELETE_RULE']!=='RESTRICT') { |
|
195 | 195 | $rule = $foreignKeys['DELETE_RULE']; |
196 | 196 | $list[] = ' $wizard->table()->foreign()->constraint(\''.$constraintName.'\')->key(\''.$key.'\')->references(\''.$referenceTable.'\',\''.$referenceColumn.'\')->onDelete()->'.strtolower($rule).'(); |
197 | 197 | '; |
198 | 198 | } |
199 | 199 | } |
200 | 200 | |
201 | - return implode('',$list); |
|
201 | + return implode('', $list); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
@@ -209,43 +209,43 @@ discard block |
||
209 | 209 | */ |
210 | 210 | private function getColumnTransformers($column) |
211 | 211 | { |
212 | - if($column=='datetime'){ |
|
212 | + if ($column=='datetime') { |
|
213 | 213 | return 'datetime()'; |
214 | 214 | } |
215 | - elseif($column=='longtext'){ |
|
215 | + elseif ($column=='longtext') { |
|
216 | 216 | return 'longtext()'; |
217 | 217 | } |
218 | - elseif($column=='date'){ |
|
218 | + elseif ($column=='date') { |
|
219 | 219 | return 'date()'; |
220 | 220 | } |
221 | - elseif($column=='text'){ |
|
221 | + elseif ($column=='text') { |
|
222 | 222 | return 'text()'; |
223 | 223 | } |
224 | - elseif($column=='timestamp'){ |
|
224 | + elseif ($column=='timestamp') { |
|
225 | 225 | return 'timestamp()'; |
226 | 226 | } |
227 | - elseif($column=='mediumint'){ |
|
227 | + elseif ($column=='mediumint') { |
|
228 | 228 | return 'mediumint()'; |
229 | 229 | } |
230 | - elseif($column=='tinyint'){ |
|
230 | + elseif ($column=='tinyint') { |
|
231 | 231 | return 'tinyint()'; |
232 | 232 | } |
233 | - elseif($column=='float'){ |
|
233 | + elseif ($column=='float') { |
|
234 | 234 | return 'float()'; |
235 | 235 | } |
236 | - elseif($column=='mediumtext'){ |
|
236 | + elseif ($column=='mediumtext') { |
|
237 | 237 | return 'mediumtext()'; |
238 | 238 | } |
239 | - elseif($column=='mediumblob'){ |
|
239 | + elseif ($column=='mediumblob') { |
|
240 | 240 | return 'mediumblob()'; |
241 | 241 | } |
242 | - elseif($column=='blob'){ |
|
242 | + elseif ($column=='blob') { |
|
243 | 243 | return 'blob()'; |
244 | 244 | } |
245 | - elseif(preg_match('@enum.*\((.*?)\)@',$column,$enum)){ |
|
245 | + elseif (preg_match('@enum.*\((.*?)\)@', $column, $enum)) { |
|
246 | 246 | return 'enum(['.$enum[1].'])'; |
247 | 247 | } |
248 | - else{ |
|
248 | + else { |
|
249 | 249 | return $column; |
250 | 250 | } |
251 | 251 | } |
@@ -257,11 +257,11 @@ discard block |
||
257 | 257 | * @param $field |
258 | 258 | * @return void|mixed |
259 | 259 | */ |
260 | - private function getIndexInformation($index,$field) |
|
260 | + private function getIndexInformation($index, $field) |
|
261 | 261 | { |
262 | 262 | foreach ($index as $key=>$item) { |
263 | 263 | |
264 | - if($item['Column_name'] == $field){ |
|
264 | + if ($item['Column_name']==$field) { |
|
265 | 265 | return $index[$key]; |
266 | 266 | } |
267 | 267 | } |
@@ -279,13 +279,13 @@ discard block |
||
279 | 279 | { |
280 | 280 | $arguments = $this->schema->getArguments(); |
281 | 281 | |
282 | - $only = explode(',',$arguments['only']); |
|
282 | + $only = explode(',', $arguments['only']); |
|
283 | 283 | |
284 | 284 | $list = []; |
285 | 285 | |
286 | - foreach($only as $table){ |
|
286 | + foreach ($only as $table) { |
|
287 | 287 | |
288 | - if(in_array($table,$tables) || in_array($table = strtolower($table),$tables)){ |
|
288 | + if (in_array($table, $tables) || in_array($table = strtolower($table), $tables)) { |
|
289 | 289 | $list[] = $table; |
290 | 290 | } |
291 | 291 | } |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | { |
305 | 305 | $list = []; |
306 | 306 | foreach ($index as $key=>$item) { |
307 | - if($item['Non_unique']==1 && $item['Key_name']!=='PRIMARY'){ |
|
307 | + if ($item['Non_unique']==1 && $item['Key_name']!=='PRIMARY') { |
|
308 | 308 | $list[$item['Key_name']][] = $item['Column_name']; |
309 | 309 | } |
310 | 310 | } |
@@ -52,8 +52,7 @@ discard block |
||
52 | 52 | if(!file_exists($makeDirectory)){ |
53 | 53 | files()->makeDirectory($makeDirectory,0755,true); |
54 | 54 | $exist=false; |
55 | - } |
|
56 | - else{ |
|
55 | + } else{ |
|
57 | 56 | $exist=true; |
58 | 57 | } |
59 | 58 | |
@@ -71,8 +70,7 @@ discard block |
||
71 | 70 | |
72 | 71 | if(substr($dbtable,-1)=='s'){ |
73 | 72 | app()->command('model create','model:'.strtolower(substr($dbtable,0,-1)).' table:'.$dbtable); |
74 | - } |
|
75 | - else{ |
|
73 | + } else{ |
|
76 | 74 | app()->command('model create','model:'.strtolower($dbtable).' table:'.$dbtable); |
77 | 75 | } |
78 | 76 | |
@@ -80,11 +78,9 @@ discard block |
||
80 | 78 | |
81 | 79 | $this->schema->getConnection()->generateEntity($dbtable); |
82 | 80 | echo $dbtablekey.'- '.$migrationName.' ---> Ok'; |
83 | - } |
|
84 | - elseif($exist){ |
|
81 | + } elseif($exist){ |
|
85 | 82 | echo $dbtablekey.'- '.$migrationName.' ---> (Already Exist)'; |
86 | - } |
|
87 | - else{ |
|
83 | + } else{ |
|
88 | 84 | echo $dbtablekey.'- '.$migrationName.' ---> Fail'; |
89 | 85 | } |
90 | 86 | |
@@ -211,41 +207,29 @@ discard block |
||
211 | 207 | { |
212 | 208 | if($column=='datetime'){ |
213 | 209 | return 'datetime()'; |
214 | - } |
|
215 | - elseif($column=='longtext'){ |
|
210 | + } elseif($column=='longtext'){ |
|
216 | 211 | return 'longtext()'; |
217 | - } |
|
218 | - elseif($column=='date'){ |
|
212 | + } elseif($column=='date'){ |
|
219 | 213 | return 'date()'; |
220 | - } |
|
221 | - elseif($column=='text'){ |
|
214 | + } elseif($column=='text'){ |
|
222 | 215 | return 'text()'; |
223 | - } |
|
224 | - elseif($column=='timestamp'){ |
|
216 | + } elseif($column=='timestamp'){ |
|
225 | 217 | return 'timestamp()'; |
226 | - } |
|
227 | - elseif($column=='mediumint'){ |
|
218 | + } elseif($column=='mediumint'){ |
|
228 | 219 | return 'mediumint()'; |
229 | - } |
|
230 | - elseif($column=='tinyint'){ |
|
220 | + } elseif($column=='tinyint'){ |
|
231 | 221 | return 'tinyint()'; |
232 | - } |
|
233 | - elseif($column=='float'){ |
|
222 | + } elseif($column=='float'){ |
|
234 | 223 | return 'float()'; |
235 | - } |
|
236 | - elseif($column=='mediumtext'){ |
|
224 | + } elseif($column=='mediumtext'){ |
|
237 | 225 | return 'mediumtext()'; |
238 | - } |
|
239 | - elseif($column=='mediumblob'){ |
|
226 | + } elseif($column=='mediumblob'){ |
|
240 | 227 | return 'mediumblob()'; |
241 | - } |
|
242 | - elseif($column=='blob'){ |
|
228 | + } elseif($column=='blob'){ |
|
243 | 229 | return 'blob()'; |
244 | - } |
|
245 | - elseif(preg_match('@enum.*\((.*?)\)@',$column,$enum)){ |
|
230 | + } elseif(preg_match('@enum.*\((.*?)\)@',$column,$enum)){ |
|
246 | 231 | return 'enum(['.$enum[1].'])'; |
247 | - } |
|
248 | - else{ |
|
232 | + } else{ |
|
249 | 233 | return $column; |
250 | 234 | } |
251 | 235 | } |
@@ -14,30 +14,30 @@ discard block |
||
14 | 14 | */ |
15 | 15 | public function processHandler() |
16 | 16 | { |
17 | - return $this->errorHandler(function(){ |
|
17 | + return $this->errorHandler(function() { |
|
18 | 18 | |
19 | 19 | $results = []; |
20 | 20 | |
21 | - foreach ($this->list as $table =>$datas){ |
|
21 | + foreach ($this->list as $table =>$datas) { |
|
22 | 22 | |
23 | - foreach ($datas as $data){ |
|
23 | + foreach ($datas as $data) { |
|
24 | 24 | |
25 | - $query = $this->queryBuilder($table,$data); |
|
25 | + $query = $this->queryBuilder($table, $data); |
|
26 | 26 | |
27 | 27 | $query = $query->handle(); |
28 | 28 | |
29 | 29 | |
30 | - if($query===false){ |
|
30 | + if ($query===false) { |
|
31 | 31 | $results[] = []; |
32 | 32 | } |
33 | - else{ |
|
34 | - $status =($query['result']!==false) ? true : false; |
|
33 | + else { |
|
34 | + $status = ($query['result']!==false) ? true : false; |
|
35 | 35 | |
36 | - if($status){ |
|
36 | + if ($status) { |
|
37 | 37 | $this->schema->getConnection()->generateEntity($table); |
38 | 38 | } |
39 | 39 | |
40 | - $results[]= [ |
|
40 | + $results[] = [ |
|
41 | 41 | 'success'=>$status, |
42 | 42 | 'file'=>$data->getFile(), |
43 | 43 | 'table'=>$table, |
@@ -67,11 +67,11 @@ discard block |
||
67 | 67 | { |
68 | 68 | $alterBinds = $object->getAlterBinds(); |
69 | 69 | |
70 | - if(!is_null($alterBinds) && count($alterBinds)>1){ |
|
70 | + if (!is_null($alterBinds) && count($alterBinds)>1) { |
|
71 | 71 | exception()->runtime('Only one command can be applied to alter groups'); |
72 | 72 | } |
73 | 73 | |
74 | - if(count($object->getError())){ |
|
74 | + if (count($object->getError())) { |
|
75 | 75 | exception()->runtime(''.$object->getFile().' -> '.$object->getError()[0].''); |
76 | 76 | } |
77 | 77 |
@@ -29,8 +29,7 @@ |
||
29 | 29 | |
30 | 30 | if($query===false){ |
31 | 31 | $results[] = []; |
32 | - } |
|
33 | - else{ |
|
32 | + } else{ |
|
34 | 33 | $status =($query['result']!==false) ? true : false; |
35 | 34 | |
36 | 35 | if($status){ |
@@ -15,25 +15,24 @@ discard block |
||
15 | 15 | { |
16 | 16 | $getCommandList = app()->commandList(); |
17 | 17 | |
18 | - $this->table->setHeaders(['command','project','params','description']); |
|
18 | + $this->table->setHeaders(['command', 'project', 'params', 'description']); |
|
19 | 19 | |
20 | 20 | $app = $this; |
21 | 21 | |
22 | - foreach ($getCommandList as $command=>$runnable){ |
|
22 | + foreach ($getCommandList as $command=>$runnable) { |
|
23 | 23 | |
24 | - $commandInstance = app()->resolve($command,['argument'=>[]]); |
|
24 | + $commandInstance = app()->resolve($command, ['argument'=>[]]); |
|
25 | 25 | |
26 | 26 | $className = class_basename($commandInstance); |
27 | 27 | |
28 | - ClosureDispatcher::bind($commandInstance)->call(function() use($app,$className) |
|
28 | + ClosureDispatcher::bind($commandInstance)->call(function() use($app, $className) |
|
29 | 29 | { |
30 | - if(isset($this->runnableMethods)){ |
|
30 | + if (isset($this->runnableMethods)) { |
|
31 | 31 | |
32 | - foreach ($this->runnableMethods as $method=>$description){ |
|
32 | + foreach ($this->runnableMethods as $method=>$description) { |
|
33 | 33 | |
34 | 34 | $commandRule = (isset($this->commandRule[$method])) ? |
35 | - $app->methodCommandRule($this->commandRule[$method]) : |
|
36 | - $app->methodCommandRule($this->commandRule); |
|
35 | + $app->methodCommandRule($this->commandRule[$method]) : $app->methodCommandRule($this->commandRule); |
|
37 | 36 | |
38 | 37 | $projectStatus = (isset($this->projectStatus)) ? 'YES' : 'NO'; |
39 | 38 | |
@@ -61,18 +60,18 @@ discard block |
||
61 | 60 | public function methodCommandRule($commandRule) |
62 | 61 | { |
63 | 62 | |
64 | - if(is_array($commandRule)){ |
|
63 | + if (is_array($commandRule)) { |
|
65 | 64 | |
66 | 65 | $list = []; |
67 | 66 | |
68 | - foreach ($commandRule as $rule){ |
|
69 | - if(!is_array($rule)){ |
|
67 | + foreach ($commandRule as $rule) { |
|
68 | + if (!is_array($rule)) { |
|
70 | 69 | $list[] = $rule.':['.$rule.']'; |
71 | 70 | } |
72 | 71 | |
73 | 72 | } |
74 | 73 | |
75 | - return implode(" ",$list); |
|
74 | + return implode(" ", $list); |
|
76 | 75 | } |
77 | 76 | |
78 | 77 | return '['.$commandRule.']'; |