@@ -11,23 +11,23 @@ |
||
| 11 | 11 | |
| 12 | 12 | $generatedFiles = []; |
| 13 | 13 | foreach ($viewsToBeGenerated as $view) { |
| 14 | - $viewTemplate = $this->buildTemplate('Views/' . $view, [ |
|
| 14 | + $viewTemplate = $this->buildTemplate('Views/'.$view, [ |
|
| 15 | 15 | '{{modelNameSingularLowercase}}' => $this->module->getModelNameSingularLowercase(), |
| 16 | 16 | '{{modelNamePlural}}' => $this->module->getModelNamePlural(), |
| 17 | 17 | '{{moduleName}}' => $this->module->getModuleName() |
| 18 | 18 | ]); |
| 19 | 19 | |
| 20 | - $fullFilePath = $this->getPath("resources/views/" . $this->module->getModuleName()) . "/{$view}.blade.php"; |
|
| 20 | + $fullFilePath = $this->getPath("resources/views/".$this->module->getModuleName())."/{$view}.blade.php"; |
|
| 21 | 21 | file_put_contents($fullFilePath, $viewTemplate); |
| 22 | - $generatedFiles[] = $fullFilePath; |
|
| 22 | + $generatedFiles[] = $fullFilePath; |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - $layoutPath = $this->getPath("resources/views/laragen/layouts/") . "app.blade.php"; |
|
| 26 | - if(!file_exists($layoutPath)){ |
|
| 25 | + $layoutPath = $this->getPath("resources/views/laragen/layouts/")."app.blade.php"; |
|
| 26 | + if (!file_exists($layoutPath)) { |
|
| 27 | 27 | |
| 28 | 28 | $viewTemplate = $this->buildTemplate('Views/layouts/app', []); |
| 29 | 29 | file_put_contents($layoutPath, $viewTemplate); |
| 30 | - $generatedFiles[] = $layoutPath; |
|
| 30 | + $generatedFiles[] = $layoutPath; |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | return $generatedFiles; |
@@ -80,23 +80,23 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | $dataDefinition = ""; |
| 82 | 82 | foreach ($this->module->getNativeData() as $columns) { |
| 83 | - foreach($columns as $column => $type){ |
|
| 83 | + foreach ($columns as $column => $type) { |
|
| 84 | 84 | $specialTypes = array_keys($specialTypesToDefinition); |
| 85 | - if(in_array($column,$specialTypes)){ |
|
| 86 | - $dataDefinition .= $this->getTabs(2) . "'{$column}'" . " => " . '$faker->' . $specialTypesToDefinition[$column]; |
|
| 87 | - } else{ |
|
| 88 | - $dataDefinition .= $this->getTabs(2) . "'{$column}'" . " => " . '$faker->' . $typeToDefinition[$type]; |
|
| 85 | + if (in_array($column, $specialTypes)) { |
|
| 86 | + $dataDefinition .= $this->getTabs(2)."'{$column}'"." => ".'$faker->'.$specialTypesToDefinition[$column]; |
|
| 87 | + } else { |
|
| 88 | + $dataDefinition .= $this->getTabs(2)."'{$column}'"." => ".'$faker->'.$typeToDefinition[$type]; |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - if($column != last($columns)) { |
|
| 92 | - $dataDefinition .= "," . PHP_EOL; |
|
| 91 | + if ($column != last($columns)) { |
|
| 92 | + $dataDefinition .= ",".PHP_EOL; |
|
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | } |
| 96 | 96 | return $dataDefinition; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - protected function getForeignData(){ |
|
| 99 | + protected function getForeignData() { |
|
| 100 | 100 | $columns = $this->module->getForeignColumns('parent'); |
| 101 | 101 | |
| 102 | 102 | $foreignData = ""; |
@@ -108,8 +108,8 @@ discard block |
||
| 108 | 108 | '{{parentModel}}' => ucfirst(camel_case(str_singular($parent))) |
| 109 | 109 | ]); |
| 110 | 110 | |
| 111 | - if($column != last($columns)) { |
|
| 112 | - $foreignData .= "," . PHP_EOL; |
|
| 111 | + if ($column != last($columns)) { |
|
| 112 | + $foreignData .= ",".PHP_EOL; |
|
| 113 | 113 | } |
| 114 | 114 | } |
| 115 | 115 | } |