@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | file_put_contents($fullFilePath, $factoryTemplate); |
| 24 | 24 | $generatedFiles[] = $fullFilePath; |
| 25 | 25 | |
| 26 | - $laragenSeederFile = (self::$initializeFlag++ == 0) ? $this->initializeFile($this->getPath("database/seeds/")."LaragenSeeder.php", 'common/Seeder') : $this->getPath("database/seeds/")."LaragenSeeder.php"; |
|
| 26 | + $laragenSeederFile = (self::$initializeFlag++ == 0) ? $this->initializeFile($this->getPath("database/seeds/")."LaragenSeeder.php", 'common/Seeder') : $this->getPath("database/seeds/")."LaragenSeeder.php"; |
|
| 27 | 27 | |
| 28 | 28 | $this->insertIntoFile( |
| 29 | 29 | $laragenSeederFile, |
@@ -93,23 +93,23 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | $dataDefinition = ""; |
| 95 | 95 | foreach ($this->module->getNativeData() as $columns) { |
| 96 | - foreach($columns as $column => $type){ |
|
| 96 | + foreach ($columns as $column => $type) { |
|
| 97 | 97 | $specialTypes = array_keys($specialTypesToDefinition); |
| 98 | - if(in_array($column,$specialTypes)){ |
|
| 99 | - $dataDefinition .= $this->getTabs(2) . "'{$column}'" . " => " . '$faker->' . $specialTypesToDefinition[$column]; |
|
| 100 | - } else{ |
|
| 101 | - $dataDefinition .= $this->getTabs(2) . "'{$column}'" . " => " . '$faker->' . $typeToDefinition[$type]; |
|
| 98 | + if (in_array($column, $specialTypes)) { |
|
| 99 | + $dataDefinition .= $this->getTabs(2)."'{$column}'"." => ".'$faker->'.$specialTypesToDefinition[$column]; |
|
| 100 | + } else { |
|
| 101 | + $dataDefinition .= $this->getTabs(2)."'{$column}'"." => ".'$faker->'.$typeToDefinition[$type]; |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - if($column != last($columns)) { |
|
| 105 | - $dataDefinition .= "," . PHP_EOL; |
|
| 104 | + if ($column != last($columns)) { |
|
| 105 | + $dataDefinition .= ",".PHP_EOL; |
|
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | return $dataDefinition; |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - protected function getForeignData(){ |
|
| 112 | + protected function getForeignData() { |
|
| 113 | 113 | $columns = $this->module->getForeignColumns('parent'); |
| 114 | 114 | |
| 115 | 115 | $foreignData = ""; |
@@ -121,8 +121,8 @@ discard block |
||
| 121 | 121 | '{{parentModel}}' => ucfirst(camel_case(str_singular($parent))) |
| 122 | 122 | ]); |
| 123 | 123 | |
| 124 | - if($column != last($columns)) { |
|
| 125 | - $foreignData .= "," . PHP_EOL; |
|
| 124 | + if ($column != last($columns)) { |
|
| 125 | + $foreignData .= ",".PHP_EOL; |
|
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 128 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | $typePieces = array_shift($this->optionArray); |
| 73 | 73 | $type = explode(':', $typePieces); |
| 74 | 74 | $this->dataType = is_array($type) ? $type[0] : $type; |
| 75 | - $this->typeOption = is_array($type)&&count($type)>=2 ? $type[1] : false; |
|
| 75 | + $this->typeOption = is_array($type) && count($type) >= 2 ? $type[1] : false; |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | public function getSchema() |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | protected function hasSpecialSchema() { |
| 147 | - if(in_array($this->dataType, self::$specialTypes)){ |
|
| 147 | + if (in_array($this->dataType, self::$specialTypes)) { |
|
| 148 | 148 | $this->specialType = $this->dataType; |
| 149 | 149 | return true; |
| 150 | 150 | } |
@@ -81,8 +81,12 @@ |
||
| 81 | 81 | $schema = $this->processSpecialSchema(); |
| 82 | 82 | } else { |
| 83 | 83 | foreach ($this->optionArray as $option) { |
| 84 | - if ($option == self::COLUMN_UNIQUE) $this->hasUnique(); |
|
| 85 | - if (is_numeric($option) && $option <= 2048) $this->hasSize((int) $option); |
|
| 84 | + if ($option == self::COLUMN_UNIQUE) { |
|
| 85 | + $this->hasUnique(); |
|
| 86 | + } |
|
| 87 | + if (is_numeric($option) && $option <= 2048) { |
|
| 88 | + $this->hasSize((int) $option); |
|
| 89 | + } |
|
| 86 | 90 | } |
| 87 | 91 | |
| 88 | 92 | $schema = '$table->'.$this->getColumnType()."('{$this->column}'"; |