Skip to content

Commit a793bcb

Browse files
authored
Merge pull request #63 from RonasIT/42-extend-nova-resource-generator
Correct logic for Nova resource creation
2 parents 1615834 + eb07a31 commit a793bcb

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/Generators/NovaResourceGenerator.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,11 @@ protected function getFieldsFromCommandLineArguments(): array
136136

137137
protected function getFieldsFromDatabase(): array
138138
{
139-
$modelClass = "App\Models\{$this->model}";
140-
$tableName = app($modelClass)->getTable();
141-
$columns = DB::getDoctrineSchemaManager($tableName);
139+
$modelClass = "App\\Models\\{$this->model}";
140+
$model = app($modelClass);
141+
$columns = DB::connection($model->getConnectionName())
142+
->getDoctrineSchemaManager()
143+
->listTableColumns($model->getTable());
142144

143145
$fields = array_map(function ($column) {
144146
return new DatabaseNovaField($column);
@@ -151,4 +153,4 @@ protected function commandFieldsExists(): bool
151153
{
152154
return !empty(Arr::flatten($this->fields));
153155
}
154-
}
156+
}

0 commit comments

Comments
 (0)