@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | $bar = $this->output->createProgressBar($models->count()); |
| 63 | 63 | |
| 64 | - $models->transform(function ($model) use ($bar) { |
|
| 64 | + $models->transform(function($model) use ($bar) { |
|
| 65 | 65 | $bar->advance(); |
| 66 | 66 | return new GraphModel( |
| 67 | 67 | $model, |
@@ -107,8 +107,7 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | protected function getOutputFileName(): string |
| 109 | 109 | { |
| 110 | - return $this->argument('filename') ?: |
|
| 111 | - static::DEFAULT_FILENAME . '.' . $this->option('format'); |
|
| 110 | + return $this->argument('filename') ?: static::DEFAULT_FILENAME . '.' . $this->option('format'); |
|
| 112 | 111 | } |
| 113 | 112 | |
| 114 | 113 | protected function getTextOutputFileName(): string |
@@ -128,7 +127,7 @@ discard block |
||
| 128 | 127 | protected function getAllModelsFromEachDirectory(array $directories): Collection |
| 129 | 128 | { |
| 130 | 129 | return collect($directories) |
| 131 | - ->map(function ($directory) { |
|
| 130 | + ->map(function($directory) { |
|
| 132 | 131 | return $this->modelFinder->getModelsInDirectory($directory)->all(); |
| 133 | 132 | }) |
| 134 | 133 | ->flatten(); |
@@ -78,8 +78,8 @@ |
||
| 78 | 78 | |
| 79 | 79 | if ($relatedModel) { |
| 80 | 80 | $output .= "- **" . $relation->getType() . "** `" . $relation->getName() . "` to " . |
| 81 | - $relatedModel->getLabel() . " (Local Key: `" . $relation->getLocalKey() . |
|
| 82 | - "`, Foreign Key: `" . $relation->getForeignKey() . "`)\n"; |
|
| 81 | + $relatedModel->getLabel() . " (Local Key: `" . $relation->getLocalKey() . |
|
| 82 | + "`, Foreign Key: `" . $relation->getForeignKey() . "`)\n"; |
|
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | foreach ($model->getRelations() as $relation) { |
| 74 | 74 | /** @var ModelRelation $relation */ |
| 75 | - $relatedModel = $models->first(function ($m) use ($relation) { |
|
| 75 | + $relatedModel = $models->first(function($m) use ($relation) { |
|
| 76 | 76 | return $m->getModel() === $relation->getRelatedModel(); |
| 77 | 77 | }); |
| 78 | 78 | |
@@ -109,23 +109,23 @@ discard block |
||
| 109 | 109 | } catch (\Throwable $e) { |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - return []; |
|
| 112 | + return [ ]; |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | protected function getModelLabel(EloquentModel $model, string $label) |
| 116 | 116 | { |
| 117 | 117 | |
| 118 | 118 | $table = '<<table width="100%" height="100%" border="0" margin="0" cellborder="1" cellspacing="0" cellpadding="10">' . PHP_EOL; |
| 119 | - $table .= '<tr width="100%"><td width="100%" bgcolor="'.config('erd-generator.table.header_background_color').'"><font color="'.config('erd-generator.table.header_font_color').'">' . $label . '</font></td></tr>' . PHP_EOL; |
|
| 119 | + $table .= '<tr width="100%"><td width="100%" bgcolor="' . config('erd-generator.table.header_background_color') . '"><font color="' . config('erd-generator.table.header_font_color') . '">' . $label . '</font></td></tr>' . PHP_EOL; |
|
| 120 | 120 | |
| 121 | 121 | if (config('erd-generator.use_db_schema')) { |
| 122 | 122 | $columns = $this->getTableColumnsFromModel($model); |
| 123 | 123 | foreach ($columns as $column) { |
| 124 | 124 | $label = $column->getName(); |
| 125 | 125 | if (config('erd-generator.use_column_types')) { |
| 126 | - $label .= ' ('.$column->getType()->getName().')'; |
|
| 126 | + $label .= ' (' . $column->getType()->getName() . ')'; |
|
| 127 | 127 | } |
| 128 | - $table .= '<tr width="100%"><td port="' . $column->getName() . '" align="left" width="100%" bgcolor="'.config('erd-generator.table.row_background_color').'"><font color="'.config('erd-generator.table.row_font_color').'" >' . $label . '</font></td></tr>' . PHP_EOL; |
|
| 128 | + $table .= '<tr width="100%"><td port="' . $column->getName() . '" align="left" width="100%" bgcolor="' . config('erd-generator.table.row_background_color') . '"><font color="' . config('erd-generator.table.row_font_color') . '" >' . $label . '</font></td></tr>' . PHP_EOL; |
|
| 129 | 129 | } |
| 130 | 130 | } |
| 131 | 131 | |
@@ -137,13 +137,13 @@ discard block |
||
| 137 | 137 | protected function addModelsToGraph(Collection $models) |
| 138 | 138 | { |
| 139 | 139 | // Add models to graph |
| 140 | - $models->map(function (Model $model) { |
|
| 140 | + $models->map(function(Model $model) { |
|
| 141 | 141 | $eloquentModel = app($model->getModel()); |
| 142 | 142 | $this->addNodeToGraph($eloquentModel, $model->getNodeName(), $model->getLabel()); |
| 143 | 143 | }); |
| 144 | 144 | |
| 145 | 145 | // Create relations |
| 146 | - $models->map(function ($model) { |
|
| 146 | + $models->map(function($model) { |
|
| 147 | 147 | $this->addRelationToGraph($model); |
| 148 | 148 | }); |
| 149 | 149 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | $edge->{"set{$key}"}($value); |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - foreach (config('erd-generator.relations.' . $relation->getType(), []) as $key => $value) { |
|
| 195 | + foreach (config('erd-generator.relations.' . $relation->getType(), [ ]) as $key => $value) { |
|
| 196 | 196 | $edge->{"set{$key}"}($value); |
| 197 | 197 | } |
| 198 | 198 | |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | ); |
| 254 | 254 | |
| 255 | 255 | $this->connectNodes($pivotModelNode, $relatedModelNode, $relation); |
| 256 | - } catch (\ReflectionException $e){} |
|
| 256 | + } catch (\ReflectionException $e) {} |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | /** |