@@ -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 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | /** @var ModelRelation $relation */ |
| 75 | 75 | // Find the related model by comparing model class names |
| 76 | 76 | $relatedModelClass = $relation->getModel(); |
| 77 | - $relatedModel = $models->first(function ($m) use ($relatedModelClass) { |
|
| 77 | + $relatedModel = $models->first(function($m) use ($relatedModelClass) { |
|
| 78 | 78 | return $m->getModel() === $relatedModelClass; |
| 79 | 79 | }); |
| 80 | 80 | |
@@ -111,23 +111,23 @@ discard block |
||
| 111 | 111 | } catch (\Throwable $e) { |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - return []; |
|
| 114 | + return [ ]; |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | protected function getModelLabel(EloquentModel $model, string $label) |
| 118 | 118 | { |
| 119 | 119 | |
| 120 | 120 | $table = '<<table width="100%" height="100%" border="0" margin="0" cellborder="1" cellspacing="0" cellpadding="10">' . PHP_EOL; |
| 121 | - $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; |
|
| 121 | + $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; |
|
| 122 | 122 | |
| 123 | 123 | if (config('erd-generator.use_db_schema')) { |
| 124 | 124 | $columns = $this->getTableColumnsFromModel($model); |
| 125 | 125 | foreach ($columns as $column) { |
| 126 | 126 | $label = $column->getName(); |
| 127 | 127 | if (config('erd-generator.use_column_types')) { |
| 128 | - $label .= ' ('.$column->getType()->getName().')'; |
|
| 128 | + $label .= ' (' . $column->getType()->getName() . ')'; |
|
| 129 | 129 | } |
| 130 | - $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; |
|
| 130 | + $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; |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | |
@@ -139,13 +139,13 @@ discard block |
||
| 139 | 139 | protected function addModelsToGraph(Collection $models) |
| 140 | 140 | { |
| 141 | 141 | // Add models to graph |
| 142 | - $models->map(function (Model $model) { |
|
| 142 | + $models->map(function(Model $model) { |
|
| 143 | 143 | $eloquentModel = app($model->getModel()); |
| 144 | 144 | $this->addNodeToGraph($eloquentModel, $model->getNodeName(), $model->getLabel()); |
| 145 | 145 | }); |
| 146 | 146 | |
| 147 | 147 | // Create relations |
| 148 | - $models->map(function ($model) { |
|
| 148 | + $models->map(function($model) { |
|
| 149 | 149 | $this->addRelationToGraph($model); |
| 150 | 150 | }); |
| 151 | 151 | } |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | $edge->{"set{$key}"}($value); |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | - foreach (config('erd-generator.relations.' . $relation->getType(), []) as $key => $value) { |
|
| 197 | + foreach (config('erd-generator.relations.' . $relation->getType(), [ ]) as $key => $value) { |
|
| 198 | 198 | $edge->{"set{$key}"}($value); |
| 199 | 199 | } |
| 200 | 200 | |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | ); |
| 256 | 256 | |
| 257 | 257 | $this->connectNodes($pivotModelNode, $relatedModelNode, $relation); |
| 258 | - } catch (\ReflectionException $e){} |
|
| 258 | + } catch (\ReflectionException $e) {} |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | /** |