@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | $columns = Schema::getColumns($table); |
40 | 40 | if (config('erd-generator.ignore_columns')) { |
41 | 41 | $columns = collect($columns)->filter(function($column) use($table) { |
42 | - if (isset($column['name'])){ |
|
43 | - return !in_array($table.'.'.$column['name'],config('erd-generator.ignore_columns')); |
|
42 | + if (isset($column[ 'name' ])) { |
|
43 | + return !in_array($table . '.' . $column[ 'name' ], config('erd-generator.ignore_columns')); |
|
44 | 44 | } |
45 | 45 | return false; |
46 | 46 | }); |
@@ -51,24 +51,24 @@ discard block |
||
51 | 51 | } catch (\Throwable $e) { |
52 | 52 | } |
53 | 53 | |
54 | - return []; |
|
54 | + return [ ]; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | protected function getModelLabel(EloquentModel $model, string $label) |
58 | 58 | { |
59 | 59 | |
60 | 60 | $table = '<<table width="100%" height="100%" border="0" margin="0" cellborder="1" cellspacing="0" cellpadding="10">' . PHP_EOL; |
61 | - $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; |
|
61 | + $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; |
|
62 | 62 | |
63 | 63 | if (config('erd-generator.use_db_schema')) { |
64 | 64 | $columns = $this->getTableColumnsFromModel($model); |
65 | 65 | foreach ($columns as $column) { |
66 | 66 | |
67 | - $label = $column['name']; |
|
68 | - if (config('erd-generator.use_column_types') && isset($column['type'])) { |
|
69 | - $label .= ' ('.$column['type'].')'; |
|
67 | + $label = $column[ 'name' ]; |
|
68 | + if (config('erd-generator.use_column_types') && isset($column[ 'type' ])) { |
|
69 | + $label .= ' (' . $column[ 'type' ] . ')'; |
|
70 | 70 | } |
71 | - $table .= '<tr width="100%"><td port="' . $column['name'] . '" 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; |
|
71 | + $table .= '<tr width="100%"><td port="' . $column[ 'name' ] . '" 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; |
|
72 | 72 | |
73 | 73 | |
74 | 74 | } |
@@ -82,13 +82,13 @@ discard block |
||
82 | 82 | protected function addModelsToGraph(Collection $models) |
83 | 83 | { |
84 | 84 | // Add models to graph |
85 | - $models->map(function (Model $model) { |
|
85 | + $models->map(function(Model $model) { |
|
86 | 86 | $eloquentModel = app($model->getModel()); |
87 | 87 | $this->addNodeToGraph($eloquentModel, $model->getNodeName(), $model->getLabel()); |
88 | 88 | }); |
89 | 89 | |
90 | 90 | // Create relations |
91 | - $models->map(function ($model) { |
|
91 | + $models->map(function($model) { |
|
92 | 92 | $this->addRelationToGraph($model); |
93 | 93 | }); |
94 | 94 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | $edge->{"set{$key}"}($value); |
138 | 138 | } |
139 | 139 | |
140 | - foreach (config('erd-generator.relations.' . $relation->getType(), []) as $key => $value) { |
|
140 | + foreach (config('erd-generator.relations.' . $relation->getType(), [ ]) as $key => $value) { |
|
141 | 141 | $edge->{"set{$key}"}($value); |
142 | 142 | } |
143 | 143 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | ); |
199 | 199 | |
200 | 200 | $this->connectNodes($pivotModelNode, $relatedModelNode, $relation); |
201 | - } catch (\ReflectionException $e){} |
|
201 | + } catch (\ReflectionException $e) {} |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |