@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | public function handle() |
| 24 | 24 | { |
| 25 | - foreach ($this->tableFilters() as $table=>$files){ |
|
| 25 | + foreach ($this->tableFilters() as $table=>$files) { |
|
| 26 | 26 | |
| 27 | 27 | $table = strtolower($table); |
| 28 | 28 | |
@@ -30,14 +30,14 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | $checkMigration = $this->schema->getConnection()->checkMigration($file); |
| 32 | 32 | |
| 33 | - if(!isset($checkMigration[0])){ |
|
| 33 | + if (!isset($checkMigration[0])) { |
|
| 34 | 34 | |
| 35 | - $getClassName = preg_replace('@(\d+)_@is','',$file); |
|
| 35 | + $getClassName = preg_replace('@(\d+)_@is', '', $file); |
|
| 36 | 36 | $className = $this->getClassName($getClassName); |
| 37 | 37 | |
| 38 | 38 | require_once ($file); |
| 39 | 39 | |
| 40 | - $capsule = new SchemaCapsule($this->config,$file,$table); |
|
| 40 | + $capsule = new SchemaCapsule($this->config, $file, $table); |
|
| 41 | 41 | |
| 42 | 42 | $this->list[$table][] = (new $className)->up($capsule); |
| 43 | 43 | } |
@@ -14,42 +14,42 @@ 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 | $this->schema->getConnection()->registerMigration($data->getFile()); |
| 30 | 30 | |
| 31 | 31 | |
| 32 | - if($query===false){ |
|
| 32 | + if ($query===false) { |
|
| 33 | 33 | $results[] = []; |
| 34 | 34 | } |
| 35 | - else{ |
|
| 36 | - $status =($query['result']!==false) ? true : false; |
|
| 35 | + else { |
|
| 36 | + $status = ($query['result']!==false) ? true : false; |
|
| 37 | 37 | |
| 38 | - if($status){ |
|
| 38 | + if ($status) { |
|
| 39 | 39 | |
| 40 | 40 | //$this->schema->getConnection()->registerMigration($data->getFile()); |
| 41 | 41 | |
| 42 | 42 | $this->schema->getConnection()->generateEntity($table); |
| 43 | 43 | |
| 44 | - if(substr($table,-1)=='s'){ |
|
| 45 | - app()->command('model create','model:'.strtolower(substr($table,0,-1)).' table:'.$table.' entity:'.$table); |
|
| 44 | + if (substr($table, -1)=='s') { |
|
| 45 | + app()->command('model create', 'model:'.strtolower(substr($table, 0, -1)).' table:'.$table.' entity:'.$table); |
|
| 46 | 46 | } |
| 47 | - else{ |
|
| 48 | - app()->command('model create','model:'.strtolower($table).' table:'.$table.' entity:'.$table); |
|
| 47 | + else { |
|
| 48 | + app()->command('model create', 'model:'.strtolower($table).' table:'.$table.' entity:'.$table); |
|
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - $results[]= [ |
|
| 52 | + $results[] = [ |
|
| 53 | 53 | 'success'=>$status, |
| 54 | 54 | 'file'=>$data->getFile(), |
| 55 | 55 | 'table'=>$table, |
@@ -79,11 +79,11 @@ discard block |
||
| 79 | 79 | { |
| 80 | 80 | $alterBinds = $object->getAlterBinds(); |
| 81 | 81 | |
| 82 | - if(!is_null($alterBinds) && count($alterBinds)>1){ |
|
| 82 | + if (!is_null($alterBinds) && count($alterBinds)>1) { |
|
| 83 | 83 | exception()->runtime('Only one command can be applied to alter groups'); |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - if(count($object->getError())){ |
|
| 86 | + if (count($object->getError())) { |
|
| 87 | 87 | exception()->runtime(''.$object->getFile().' -> '.$object->getError()[0].''); |
| 88 | 88 | } |
| 89 | 89 | |