Skip to content

Commit

Permalink
Implemented usage of model attributes first
Browse files Browse the repository at this point in the history
  • Loading branch information
allanvb committed Aug 17, 2021
1 parent adb4fc0 commit a24609d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

All notable changes in Laravel Nova Exports will be documented in this file

## 1.1.2
- Implemented usage of model attributes first

## 1.1.1
- Added `disk()` method for external storages.

Expand Down
16 changes: 11 additions & 5 deletions src/NovaExportAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,17 @@ public function __construct(NovaResource $novaResource)

$this->table = $this->model->getTable();

$this->tableColumns = collect(
Schema::getColumnListing(
$this->table
)
);
$modelAttributes = array_keys($novaResource->resource->getAttributes());

if (!blank($modelAttributes)) {
$this->tableColumns = collect($modelAttributes);
} else {
$this->tableColumns = collect(
Schema::getColumnListing(
$this->table
)
);
}

$this->queryBuilder = DB::table(
$this->table
Expand Down

0 comments on commit a24609d

Please sign in to comment.