@@ -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,25 +51,25 @@ 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 | - if (isset($column['name'])) { |
|
| 68 | - $label = $column['name']; |
|
| 69 | - if (config('erd-generator.use_column_types') && isset($column['type'])) { |
|
| 70 | - $label .= ' ('.$column['type'].')'; |
|
| 67 | + if (isset($column[ 'name' ])) { |
|
| 68 | + $label = $column[ 'name' ]; |
|
| 69 | + if (config('erd-generator.use_column_types') && isset($column[ 'type' ])) { |
|
| 70 | + $label .= ' (' . $column[ 'type' ] . ')'; |
|
| 71 | 71 | } |
| 72 | - $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 | + $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; |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | } |
@@ -83,13 +83,13 @@ discard block |
||
| 83 | 83 | protected function addModelsToGraph(Collection $models) |
| 84 | 84 | { |
| 85 | 85 | // Add models to graph |
| 86 | - $models->map(function (Model $model) { |
|
| 86 | + $models->map(function(Model $model) { |
|
| 87 | 87 | $eloquentModel = app($model->getModel()); |
| 88 | 88 | $this->addNodeToGraph($eloquentModel, $model->getNodeName(), $model->getLabel()); |
| 89 | 89 | }); |
| 90 | 90 | |
| 91 | 91 | // Create relations |
| 92 | - $models->map(function ($model) { |
|
| 92 | + $models->map(function($model) { |
|
| 93 | 93 | $this->addRelationToGraph($model); |
| 94 | 94 | }); |
| 95 | 95 | } |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | $edge->{"set{$key}"}($value); |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - foreach (config('erd-generator.relations.' . $relation->getType(), []) as $key => $value) { |
|
| 141 | + foreach (config('erd-generator.relations.' . $relation->getType(), [ ]) as $key => $value) { |
|
| 142 | 142 | $edge->{"set{$key}"}($value); |
| 143 | 143 | } |
| 144 | 144 | |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | ); |
| 200 | 200 | |
| 201 | 201 | $this->connectNodes($pivotModelNode, $relatedModelNode, $relation); |
| 202 | - } catch (\ReflectionException $e){} |
|
| 202 | + } catch (\ReflectionException $e) {} |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | /** |