@@ -30,8 +30,7 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | if($query===false){ |
| 32 | 32 | $results[] = []; |
| 33 | - } |
|
| 34 | - else{ |
|
| 33 | + } else{ |
|
| 35 | 34 | $status =($query['result']!==false) ? true : false; |
| 36 | 35 | |
| 37 | 36 | if($status){ |
@@ -42,8 +41,7 @@ discard block |
||
| 42 | 41 | |
| 43 | 42 | if(substr($table,-1)=='s'){ |
| 44 | 43 | //app()->command('model create','model:'.strtolower(substr($table,0,-1)).' table:'.$table.' entity:'.$table); |
| 45 | - } |
|
| 46 | - else{ |
|
| 44 | + } else{ |
|
| 47 | 45 | //app()->command('model create','model:'.strtolower($table).' table:'.$table.' entity:'.$table); |
| 48 | 46 | } |
| 49 | 47 | } |
@@ -14,39 +14,39 @@ 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 | - if($query===false){ |
|
| 29 | + if ($query===false) { |
|
| 30 | 30 | $results[] = []; |
| 31 | 31 | } |
| 32 | - else{ |
|
| 33 | - $status =($query['result']!==false) ? true : false; |
|
| 32 | + else { |
|
| 33 | + $status = ($query['result']!==false) ? true : false; |
|
| 34 | 34 | |
| 35 | - if($status){ |
|
| 35 | + if ($status) { |
|
| 36 | 36 | |
| 37 | - $this->schema->getConnection()->registerMigration($table,$data->getFile()); |
|
| 37 | + $this->schema->getConnection()->registerMigration($table, $data->getFile()); |
|
| 38 | 38 | |
| 39 | 39 | //$this->schema->getConnection()->generateEntity($table); |
| 40 | 40 | |
| 41 | - if(substr($table,-1)=='s'){ |
|
| 41 | + if (substr($table, -1)=='s') { |
|
| 42 | 42 | //app()->command('model create','model:'.strtolower(substr($table,0,-1)).' table:'.$table.' entity:'.$table); |
| 43 | 43 | } |
| 44 | - else{ |
|
| 44 | + else { |
|
| 45 | 45 | //app()->command('model create','model:'.strtolower($table).' table:'.$table.' entity:'.$table); |
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - $results[]= [ |
|
| 49 | + $results[] = [ |
|
| 50 | 50 | 'success'=>$status, |
| 51 | 51 | 'file'=>$data->getFile(), |
| 52 | 52 | 'table'=>$table, |
@@ -76,11 +76,11 @@ discard block |
||
| 76 | 76 | { |
| 77 | 77 | $alterBinds = $object->getAlterBinds(); |
| 78 | 78 | |
| 79 | - if(!is_null($alterBinds) && count($alterBinds)>1){ |
|
| 79 | + if (!is_null($alterBinds) && count($alterBinds)>1) { |
|
| 80 | 80 | exception()->runtime('Only one command can be applied to alter groups'); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - if(count($object->getError())){ |
|
| 83 | + if (count($object->getError())) { |
|
| 84 | 84 | exception()->runtime(''.$object->getFile().' -> '.$object->getError()[0].''); |
| 85 | 85 | } |
| 86 | 86 | |
@@ -32,25 +32,25 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | private function addColumn($alterType) |
| 34 | 34 | { |
| 35 | - if(isset($alterType['place'])){ |
|
| 35 | + if (isset($alterType['place'])) { |
|
| 36 | 36 | |
| 37 | 37 | |
| 38 | - foreach ($alterType['place'] as $placeKey=>$placeValue){ |
|
| 39 | - $placeList=$placeKey .' '.$placeValue.''; |
|
| 38 | + foreach ($alterType['place'] as $placeKey=>$placeValue) { |
|
| 39 | + $placeList = $placeKey.' '.$placeValue.''; |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - $syntax = implode("",$this->syntax); |
|
| 42 | + $syntax = implode("", $this->syntax); |
|
| 43 | 43 | |
| 44 | 44 | $alterSytanx = 'ALTER TABLE '.$this->table.' ADD COLUMN '.$syntax.' '.$placeList; |
| 45 | 45 | |
| 46 | - $query=$this->schema->getConnection()->setQueryBasic($alterSytanx); |
|
| 46 | + $query = $this->schema->getConnection()->setQueryBasic($alterSytanx); |
|
| 47 | 47 | |
| 48 | - if(count($this->alterExtras)){ |
|
| 49 | - foreach($this->alterExtras as $extra){ |
|
| 48 | + if (count($this->alterExtras)) { |
|
| 49 | + foreach ($this->alterExtras as $extra) { |
|
| 50 | 50 | |
| 51 | 51 | $extraSyntax = 'ALTER TABLE '.$this->table.' '.$extra.''; |
| 52 | 52 | |
| 53 | - $query=$this->schema->getConnection()->setQueryBasic($extraSyntax); |
|
| 53 | + $query = $this->schema->getConnection()->setQueryBasic($extraSyntax); |
|
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | |
@@ -74,40 +74,40 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | private function change($alterType) |
| 76 | 76 | { |
| 77 | - if(isset($alterType['place'])){ |
|
| 77 | + if (isset($alterType['place'])) { |
|
| 78 | 78 | |
| 79 | - foreach ($alterType['place'] as $placeKey=>$placeValue){ |
|
| 80 | - $placeList=$placeKey .' '.$placeValue.''; |
|
| 79 | + foreach ($alterType['place'] as $placeKey=>$placeValue) { |
|
| 80 | + $placeList = $placeKey.' '.$placeValue.''; |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - $syntax = implode("",$this->syntax); |
|
| 83 | + $syntax = implode("", $this->syntax); |
|
| 84 | 84 | |
| 85 | 85 | $columns = $this->schema->getConnection()->showColumnsFrom($this->table); |
| 86 | 86 | |
| 87 | - foreach ($columns as $columnKey=>$columnData){ |
|
| 88 | - if($columnData['Field']==$placeValue){ |
|
| 87 | + foreach ($columns as $columnKey=>$columnData) { |
|
| 88 | + if ($columnData['Field']==$placeValue) { |
|
| 89 | 89 | $changeAbleField = $columns[$columnKey+1]['Field']; |
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - $syntaxList = explode(' ',$syntax); |
|
| 93 | + $syntaxList = explode(' ', $syntax); |
|
| 94 | 94 | |
| 95 | - if(current($syntaxList)!==$changeAbleField){ |
|
| 96 | - $alterSytanx = 'ALTER TABLE '.$this->table.' change '.$changeAbleField.' '.current($syntaxList).' '.implode(' ',array_splice($syntaxList,1)).' '.$placeList; |
|
| 95 | + if (current($syntaxList)!==$changeAbleField) { |
|
| 96 | + $alterSytanx = 'ALTER TABLE '.$this->table.' change '.$changeAbleField.' '.current($syntaxList).' '.implode(' ', array_splice($syntaxList, 1)).' '.$placeList; |
|
| 97 | 97 | } |
| 98 | - else{ |
|
| 98 | + else { |
|
| 99 | 99 | $alterSytanx = 'ALTER TABLE '.$this->table.' modify '.$syntax.' '.$placeList; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | |
| 103 | - $query=$this->schema->getConnection()->setQueryBasic($alterSytanx); |
|
| 103 | + $query = $this->schema->getConnection()->setQueryBasic($alterSytanx); |
|
| 104 | 104 | |
| 105 | - if(count($this->alterExtras)){ |
|
| 106 | - foreach($this->alterExtras as $extra){ |
|
| 105 | + if (count($this->alterExtras)) { |
|
| 106 | + foreach ($this->alterExtras as $extra) { |
|
| 107 | 107 | |
| 108 | 108 | $extraSyntax = 'ALTER TABLE '.$this->table.' '.$extra.''; |
| 109 | 109 | |
| 110 | - $query=$this->schema->getConnection()->setQueryBasic($extraSyntax); |
|
| 110 | + $query = $this->schema->getConnection()->setQueryBasic($extraSyntax); |
|
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | 113 | |
@@ -129,17 +129,17 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | private function addIndex($alterType) |
| 131 | 131 | { |
| 132 | - if(isset($this->syntax[0])){ |
|
| 132 | + if (isset($this->syntax[0])) { |
|
| 133 | 133 | |
| 134 | 134 | $index = $this->syntax[0]; |
| 135 | 135 | |
| 136 | - foreach($index as $name=>$item){ |
|
| 136 | + foreach ($index as $name=>$item) { |
|
| 137 | 137 | $index_name = $name; |
| 138 | - $indexes = implode(',',$item); |
|
| 138 | + $indexes = implode(',', $item); |
|
| 139 | 139 | } |
| 140 | 140 | $alterSytanx = 'create index '.$index_name.' on '.$this->table.' ('.$indexes.')'; |
| 141 | 141 | |
| 142 | - $query=$this->schema->getConnection()->setQueryBasic($alterSytanx); |
|
| 142 | + $query = $this->schema->getConnection()->setQueryBasic($alterSytanx); |
|
| 143 | 143 | |
| 144 | 144 | return [ |
| 145 | 145 | 'syntax'=>$this->syntax, |
@@ -160,17 +160,17 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | private function addUnique($alterType) |
| 162 | 162 | { |
| 163 | - if(isset($this->syntax[0])){ |
|
| 163 | + if (isset($this->syntax[0])) { |
|
| 164 | 164 | |
| 165 | 165 | $unique = $this->syntax[0]; |
| 166 | 166 | |
| 167 | - foreach($unique as $name=>$item){ |
|
| 167 | + foreach ($unique as $name=>$item) { |
|
| 168 | 168 | $unique_name = $name; |
| 169 | - $uniques = implode(',',$item); |
|
| 169 | + $uniques = implode(',', $item); |
|
| 170 | 170 | } |
| 171 | 171 | $alterSytanx = 'ALTER TABLE '.$this->table.' ADD CONSTRAINT '.$unique_name.' UNIQUE ('.$uniques.')'; |
| 172 | 172 | |
| 173 | - $query=$this->schema->getConnection()->setQueryBasic($alterSytanx); |
|
| 173 | + $query = $this->schema->getConnection()->setQueryBasic($alterSytanx); |
|
| 174 | 174 | |
| 175 | 175 | return [ |
| 176 | 176 | 'syntax'=>$this->syntax, |
@@ -191,13 +191,13 @@ discard block |
||
| 191 | 191 | */ |
| 192 | 192 | private function dropColumn($alterType) |
| 193 | 193 | { |
| 194 | - if(isset($this->syntax[0])){ |
|
| 194 | + if (isset($this->syntax[0])) { |
|
| 195 | 195 | |
| 196 | 196 | $column = rtrim($this->syntax[0]); |
| 197 | 197 | |
| 198 | 198 | $alterSytanx = 'alter table '.$this->table.' drop column '.$column; |
| 199 | 199 | |
| 200 | - $query=$this->schema->getConnection()->setQueryBasic($alterSytanx); |
|
| 200 | + $query = $this->schema->getConnection()->setQueryBasic($alterSytanx); |
|
| 201 | 201 | |
| 202 | 202 | return [ |
| 203 | 203 | 'syntax'=>$this->syntax, |
@@ -218,15 +218,15 @@ discard block |
||
| 218 | 218 | */ |
| 219 | 219 | private function dropKey($alterType) |
| 220 | 220 | { |
| 221 | - if(isset($this->syntax[0])){ |
|
| 221 | + if (isset($this->syntax[0])) { |
|
| 222 | 222 | |
| 223 | 223 | $dropKey = $this->syntax[0]; |
| 224 | 224 | |
| 225 | - foreach ($dropKey as $dropType=>$dropName){ |
|
| 225 | + foreach ($dropKey as $dropType=>$dropName) { |
|
| 226 | 226 | |
| 227 | 227 | $alterSytanx = 'alter table '.$this->table.' drop '.$dropType.' '.$dropName; |
| 228 | 228 | |
| 229 | - $query=$this->schema->getConnection()->setQueryBasic($alterSytanx); |
|
| 229 | + $query = $this->schema->getConnection()->setQueryBasic($alterSytanx); |
|
| 230 | 230 | |
| 231 | 231 | return [ |
| 232 | 232 | 'syntax'=>$this->syntax, |
@@ -256,32 +256,32 @@ discard block |
||
| 256 | 256 | |
| 257 | 257 | $this->getDefaultSyntaxGroup(); |
| 258 | 258 | |
| 259 | - $this->syntax[]=')'; |
|
| 259 | + $this->syntax[] = ')'; |
|
| 260 | 260 | |
| 261 | 261 | //get table collation |
| 262 | - if(isset($this->data['tableCollation']['table'])){ |
|
| 263 | - $this->syntax[]=' DEFAULT CHARACTER SET '.$this->data['tableCollation']['table']; |
|
| 262 | + if (isset($this->data['tableCollation']['table'])) { |
|
| 263 | + $this->syntax[] = ' DEFAULT CHARACTER SET '.$this->data['tableCollation']['table']; |
|
| 264 | 264 | } |
| 265 | - else{ |
|
| 266 | - $this->syntax[]=' DEFAULT CHARACTER SET utf8'; |
|
| 265 | + else { |
|
| 266 | + $this->syntax[] = ' DEFAULT CHARACTER SET utf8'; |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | //get engine |
| 270 | - if($this->data['engine']!==null) |
|
| 270 | + if ($this->data['engine']!==null) |
|
| 271 | 271 | { |
| 272 | - $this->syntax[]=' ENGINE='.$this->data['engine'].' '; |
|
| 272 | + $this->syntax[] = ' ENGINE='.$this->data['engine'].' '; |
|
| 273 | 273 | } |
| 274 | - else{ |
|
| 275 | - $this->syntax[]=' ENGINE=InnoDB '; |
|
| 274 | + else { |
|
| 275 | + $this->syntax[] = ' ENGINE=InnoDB '; |
|
| 276 | 276 | } |
| 277 | 277 | |
| 278 | - $syntax = implode("",$this->syntax); |
|
| 278 | + $syntax = implode("", $this->syntax); |
|
| 279 | 279 | |
| 280 | - if(in_array($this->table,$existTables)){ |
|
| 280 | + if (in_array($this->table, $existTables)) { |
|
| 281 | 281 | return false; |
| 282 | 282 | } |
| 283 | - else{ |
|
| 284 | - $query=$this->schema->getConnection()->setQueryBasic($syntax); |
|
| 283 | + else { |
|
| 284 | + $query = $this->schema->getConnection()->setQueryBasic($syntax); |
|
| 285 | 285 | |
| 286 | 286 | return [ |
| 287 | 287 | 'syntax'=>$syntax, |
@@ -296,52 +296,52 @@ discard block |
||
| 296 | 296 | /** |
| 297 | 297 | * @param null $group |
| 298 | 298 | */ |
| 299 | - private function getDefaultSyntaxGroup($group=null) |
|
| 299 | + private function getDefaultSyntaxGroup($group = null) |
|
| 300 | 300 | { |
| 301 | - $this->syntax[] = implode(",",$this->getCreateDefaultList()); |
|
| 301 | + $this->syntax[] = implode(",", $this->getCreateDefaultList()); |
|
| 302 | 302 | |
| 303 | 303 | //get unique values |
| 304 | - if(isset($this->data['uniqueValueList']) && count($this->data['uniqueValueList'])){ |
|
| 304 | + if (isset($this->data['uniqueValueList']) && count($this->data['uniqueValueList'])) { |
|
| 305 | 305 | |
| 306 | - if($group=='create'){ |
|
| 307 | - $this->syntax[]=','.implode(',',$this->data['uniqueValueList']); |
|
| 306 | + if ($group=='create') { |
|
| 307 | + $this->syntax[] = ','.implode(',', $this->data['uniqueValueList']); |
|
| 308 | 308 | } |
| 309 | - else{ |
|
| 310 | - $this->alterExtras[]='ADD '.implode(',',$this->data['uniqueValueList']); |
|
| 309 | + else { |
|
| 310 | + $this->alterExtras[] = 'ADD '.implode(',', $this->data['uniqueValueList']); |
|
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | //get index values |
| 316 | - if(isset($this->data['indexValueList']) && count($this->data['indexValueList'])){ |
|
| 316 | + if (isset($this->data['indexValueList']) && count($this->data['indexValueList'])) { |
|
| 317 | 317 | |
| 318 | - if($group=='create'){ |
|
| 319 | - $this->syntax[]=','.implode(',',$this->data['indexValueList']); |
|
| 318 | + if ($group=='create') { |
|
| 319 | + $this->syntax[] = ','.implode(',', $this->data['indexValueList']); |
|
| 320 | 320 | } |
| 321 | - else{ |
|
| 322 | - $this->alterExtras[]='ADD '.implode(',',$this->data['indexValueList']); |
|
| 321 | + else { |
|
| 322 | + $this->alterExtras[] = 'ADD '.implode(',', $this->data['indexValueList']); |
|
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | //get index values for key |
| 328 | - if(count($this->getKeyList())){ |
|
| 329 | - $this->syntax[]=','.implode(',',$this->getKeyList()); |
|
| 328 | + if (count($this->getKeyList())) { |
|
| 329 | + $this->syntax[] = ','.implode(',', $this->getKeyList()); |
|
| 330 | 330 | } |
| 331 | 331 | |
| 332 | - if(count($this->data['references'])){ |
|
| 333 | - $this->syntax[]=$this->getReferenceSyntax($this->data['references']); |
|
| 332 | + if (count($this->data['references'])) { |
|
| 333 | + $this->syntax[] = $this->getReferenceSyntax($this->data['references']); |
|
| 334 | 334 | } |
| 335 | 335 | |
| 336 | - if(isset($this->syntax[0]) && $this->syntax[0]=='' && $group=='addIndex'){ |
|
| 336 | + if (isset($this->syntax[0]) && $this->syntax[0]=='' && $group=='addIndex') { |
|
| 337 | 337 | $this->syntax[0] = $this->data['index']; |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | - if(isset($this->syntax[0]) && $this->syntax[0]=='' && $group=='addUnique'){ |
|
| 340 | + if (isset($this->syntax[0]) && $this->syntax[0]=='' && $group=='addUnique') { |
|
| 341 | 341 | $this->syntax[0] = $this->data['unique']; |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | - if(isset($this->syntax[0]) && $this->syntax[0]=='' && $group=='dropKey'){ |
|
| 344 | + if (isset($this->syntax[0]) && $this->syntax[0]=='' && $group=='dropKey') { |
|
| 345 | 345 | $this->syntax[0] = $this->data['key']; |
| 346 | 346 | } |
| 347 | 347 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | /** |
| 31 | 31 | * @var array |
| 32 | 32 | */ |
| 33 | - protected $auto_increment=array(); |
|
| 33 | + protected $auto_increment = array(); |
|
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * @var $collation |
@@ -45,12 +45,12 @@ discard block |
||
| 45 | 45 | /** |
| 46 | 46 | * @var array $primaryKey |
| 47 | 47 | */ |
| 48 | - protected $primaryKey=array(); |
|
| 48 | + protected $primaryKey = array(); |
|
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | 51 | * @var array $references |
| 52 | 52 | */ |
| 53 | - protected $references=array(); |
|
| 53 | + protected $references = array(); |
|
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | 56 | * @var $schemaType |
@@ -65,17 +65,17 @@ discard block |
||
| 65 | 65 | /** |
| 66 | 66 | * @var $name array |
| 67 | 67 | */ |
| 68 | - protected $name=array(); |
|
| 68 | + protected $name = array(); |
|
| 69 | 69 | |
| 70 | 70 | /** |
| 71 | 71 | * @var array $nullable |
| 72 | 72 | */ |
| 73 | - protected $nullable=array(); |
|
| 73 | + protected $nullable = array(); |
|
| 74 | 74 | |
| 75 | 75 | /** |
| 76 | 76 | * @var array $types |
| 77 | 77 | */ |
| 78 | - protected $types=array(); |
|
| 78 | + protected $types = array(); |
|
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | 81 | * @var $engine |
@@ -85,22 +85,22 @@ discard block |
||
| 85 | 85 | /** |
| 86 | 86 | * @var $default array |
| 87 | 87 | */ |
| 88 | - protected $default=array(); |
|
| 88 | + protected $default = array(); |
|
| 89 | 89 | |
| 90 | 90 | /** |
| 91 | 91 | * @var array $index |
| 92 | 92 | */ |
| 93 | - protected $index=array(); |
|
| 93 | + protected $index = array(); |
|
| 94 | 94 | |
| 95 | 95 | /** |
| 96 | 96 | * @var array |
| 97 | 97 | */ |
| 98 | - protected $key=array(); |
|
| 98 | + protected $key = array(); |
|
| 99 | 99 | |
| 100 | 100 | /** |
| 101 | 101 | * @var array $unique |
| 102 | 102 | */ |
| 103 | - protected $unique=array(); |
|
| 103 | + protected $unique = array(); |
|
| 104 | 104 | |
| 105 | 105 | /** |
| 106 | 106 | * @var $table |
@@ -112,13 +112,13 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | public function auto_increment() |
| 114 | 114 | { |
| 115 | - if(count($this->auto_increment)==0){ |
|
| 115 | + if (count($this->auto_increment)==0) { |
|
| 116 | 116 | |
| 117 | - if($this->getLastName()===false){ |
|
| 118 | - $this->name[]='id'; |
|
| 119 | - $this->setTypes('int',14); |
|
| 117 | + if ($this->getLastName()===false) { |
|
| 118 | + $this->name[] = 'id'; |
|
| 119 | + $this->setTypes('int', 14); |
|
| 120 | 120 | } |
| 121 | - $this->auto_increment[$this->getLastName()]=true; |
|
| 121 | + $this->auto_increment[$this->getLastName()] = true; |
|
| 122 | 122 | $this->primaryKey(); |
| 123 | 123 | } |
| 124 | 124 | } |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | public function comment($value) |
| 131 | 131 | { |
| 132 | - $this->comment[$this->getLastName()]=$value; |
|
| 132 | + $this->comment[$this->getLastName()] = $value; |
|
| 133 | 133 | |
| 134 | 134 | return $this; |
| 135 | 135 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | */ |
| 141 | 141 | public function name($name) |
| 142 | 142 | { |
| 143 | - if(in_array($name,$this->name)){ |
|
| 143 | + if (in_array($name, $this->name)) { |
|
| 144 | 144 | $this->setError('You have written the '.$name.' name more than 1.'); |
| 145 | 145 | } |
| 146 | 146 | |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | public function default($value) |
| 158 | 158 | { |
| 159 | - $this->default[$this->getLastName()]=$value; |
|
| 159 | + $this->default[$this->getLastName()] = $value; |
|
| 160 | 160 | |
| 161 | 161 | return $this; |
| 162 | 162 | } |
@@ -166,14 +166,14 @@ discard block |
||
| 166 | 166 | * @param bool $table |
| 167 | 167 | * @return $this |
| 168 | 168 | */ |
| 169 | - public function collation($value,$table=false) |
|
| 169 | + public function collation($value, $table = false) |
|
| 170 | 170 | { |
| 171 | - if($table===false) |
|
| 171 | + if ($table===false) |
|
| 172 | 172 | { |
| 173 | - $this->collation[$this->getLastName()]=$value; |
|
| 173 | + $this->collation[$this->getLastName()] = $value; |
|
| 174 | 174 | } |
| 175 | - else{ |
|
| 176 | - $this->collation['table']=$value; |
|
| 175 | + else { |
|
| 176 | + $this->collation['table'] = $value; |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | return $this; |
@@ -185,17 +185,17 @@ discard block |
||
| 185 | 185 | * @param bool $key |
| 186 | 186 | * @return $this|WizardContract |
| 187 | 187 | */ |
| 188 | - public function index($name=null,$value=null,$key=false) |
|
| 188 | + public function index($name = null, $value = null, $key = false) |
|
| 189 | 189 | { |
| 190 | 190 | $name = ($name===null) ? $this->getLastName() : $name; |
| 191 | 191 | $value = ($value===null) ? $name : $value; |
| 192 | 192 | |
| 193 | - if($key===false){ |
|
| 194 | - $this->index[$this->getLastName()]=['name'=>$name,'value'=>$value]; |
|
| 193 | + if ($key===false) { |
|
| 194 | + $this->index[$this->getLastName()] = ['name'=>$name, 'value'=>$value]; |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | - if($key===true){ |
|
| 198 | - $this->index['indexes'][]=['name'=>$name,'value'=>$value]; |
|
| 197 | + if ($key===true) { |
|
| 198 | + $this->index['indexes'][] = ['name'=>$name, 'value'=>$value]; |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | return $this; |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | * @param array $indexes |
| 207 | 207 | * @return void |
| 208 | 208 | */ |
| 209 | - public function indexes($index_name,$indexes=array()) |
|
| 209 | + public function indexes($index_name, $indexes = array()) |
|
| 210 | 210 | { |
| 211 | 211 | $this->index[$index_name] = $indexes; |
| 212 | 212 | } |
@@ -223,9 +223,9 @@ discard block |
||
| 223 | 223 | * @param bool $null |
| 224 | 224 | * @return $this |
| 225 | 225 | */ |
| 226 | - public function nullable($null=true) |
|
| 226 | + public function nullable($null = true) |
|
| 227 | 227 | { |
| 228 | - $this->nullable[$this->getLastName()]=$null; |
|
| 228 | + $this->nullable[$this->getLastName()] = $null; |
|
| 229 | 229 | |
| 230 | 230 | return $this; |
| 231 | 231 | } |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | */ |
| 236 | 236 | public function primaryKey() |
| 237 | 237 | { |
| 238 | - $this->primaryKey[$this->getLastName()]=true; |
|
| 238 | + $this->primaryKey[$this->getLastName()] = true; |
|
| 239 | 239 | |
| 240 | 240 | return $this; |
| 241 | 241 | } |
@@ -253,12 +253,12 @@ discard block |
||
| 253 | 253 | * @param null $value |
| 254 | 254 | * @return $this|mixed |
| 255 | 255 | */ |
| 256 | - public function unique($name=null,$value=null) |
|
| 256 | + public function unique($name = null, $value = null) |
|
| 257 | 257 | { |
| 258 | 258 | $name = ($name===null) ? $this->getLastName() : $name; |
| 259 | 259 | $value = ($value===null) ? $name : $value; |
| 260 | 260 | |
| 261 | - $this->unique[$this->getLastName()] = ['name'=>$name,'value'=>$value]; |
|
| 261 | + $this->unique[$this->getLastName()] = ['name'=>$name, 'value'=>$value]; |
|
| 262 | 262 | |
| 263 | 263 | return $this; |
| 264 | 264 | } |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | * @param null $value |
| 269 | 269 | * @return $this|mixed |
| 270 | 270 | */ |
| 271 | - public function uniques($unique_name,$uniques=array()) |
|
| 271 | + public function uniques($unique_name, $uniques = array()) |
|
| 272 | 272 | { |
| 273 | 273 | $this->unique[$unique_name] = $uniques; |
| 274 | 274 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | private function getWizardAlterInstance($group) |
| 92 | 92 | { |
| 93 | - $this->setAlterType('group',$group); |
|
| 93 | + $this->setAlterType('group', $group); |
|
| 94 | 94 | |
| 95 | 95 | return new WizardAlter($this); |
| 96 | 96 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | private function dropWizardAlterInstance($group) |
| 103 | 103 | { |
| 104 | - $this->setAlterType('group',$group); |
|
| 104 | + $this->setAlterType('group', $group); |
|
| 105 | 105 | |
| 106 | 106 | return $this; |
| 107 | 107 | } |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | private function dropKeyWizardAlterInstance($group) |
| 114 | 114 | { |
| 115 | - $this->setAlterType('group',$group); |
|
| 115 | + $this->setAlterType('group', $group); |
|
| 116 | 116 | |
| 117 | 117 | return $this; |
| 118 | 118 | } |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | */ |
| 124 | 124 | private function addIndexWizardAlterInstance($group) |
| 125 | 125 | { |
| 126 | - $this->setAlterType('group',$group); |
|
| 126 | + $this->setAlterType('group', $group); |
|
| 127 | 127 | |
| 128 | 128 | return $this; |
| 129 | 129 | } |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | private function addUniqueWizardAlterInstance($group) |
| 136 | 136 | { |
| 137 | - $this->setAlterType('group',$group); |
|
| 137 | + $this->setAlterType('group', $group); |
|
| 138 | 138 | |
| 139 | 139 | return $this; |
| 140 | 140 | } |