refactor: Update Excel export setup in Filament resources to use fromTable() method for improved consistency and maintainability
This commit is contained in:
parent
4f465b17bb
commit
75bd1ad3e6
@ -16,7 +16,9 @@ public function setUp()
|
||||
{
|
||||
$this->withFilename(fn ($resource) => $resource::getModelLabel().'-'.date('Y-m-d'));
|
||||
|
||||
$this->withColumns([
|
||||
$this->fromTable()
|
||||
->except(['index'])
|
||||
->withColumns([
|
||||
Column::make('title')
|
||||
->heading('Judul'),
|
||||
|
||||
|
||||
@ -16,7 +16,9 @@ public function setUp()
|
||||
{
|
||||
$this->withFilename(fn ($resource) => $resource::getModelLabel().'-'.date('Y-m-d'));
|
||||
|
||||
$this->withColumns([
|
||||
$this->fromTable()
|
||||
->except(['index'])
|
||||
->withColumns([
|
||||
Column::make('mediaMonitoring.title')
|
||||
->heading('Judul Berita'),
|
||||
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Enums\Channel;
|
||||
use Maatwebsite\Excel\Concerns\WithEvents;
|
||||
use Maatwebsite\Excel\Concerns\WithStyles;
|
||||
use Maatwebsite\Excel\Events\AfterSheet;
|
||||
@ -17,7 +16,9 @@ public function setUp()
|
||||
{
|
||||
$this->withFilename(fn ($resource) => $resource::getModelLabel().'-'.date('Y-m-d'));
|
||||
|
||||
$this->withColumns([
|
||||
$this->fromTable()
|
||||
->except(['index'])
|
||||
->withColumns([
|
||||
Column::make('code')
|
||||
->heading('Kode'),
|
||||
|
||||
@ -29,7 +30,7 @@ public function setUp()
|
||||
|
||||
Column::make('channel')
|
||||
->heading('Kanal')
|
||||
->formatStateUsing(fn ($state) => Channel::tryFrom($state)?->getLabel() ?? $state),
|
||||
->formatStateUsing(fn ($state) => $state->getLabel() ?? $state),
|
||||
|
||||
Column::make('writter')
|
||||
->heading('Penulis'),
|
||||
|
||||
@ -22,8 +22,7 @@ protected function getHeaderActions(): array
|
||||
|
||||
ExportAction::make()
|
||||
->exports([
|
||||
ContentRecapExcelExport::make()
|
||||
->fromTable(),
|
||||
ContentRecapExcelExport::make(),
|
||||
])
|
||||
->color('success')
|
||||
->icon(null),
|
||||
|
||||
@ -22,8 +22,7 @@ protected function getHeaderActions(): array
|
||||
|
||||
ExportAction::make()
|
||||
->exports([
|
||||
IssueManagementExcelExport::make()
|
||||
->fromTable(),
|
||||
IssueManagementExcelExport::make(),
|
||||
])
|
||||
->color('success')
|
||||
->icon(null),
|
||||
|
||||
@ -25,8 +25,7 @@ protected function getHeaderActions(): array
|
||||
|
||||
ExportAction::make()
|
||||
->exports([
|
||||
MediaMonitoringExcelExport::make()
|
||||
->fromTable(),
|
||||
MediaMonitoringExcelExport::make(),
|
||||
])
|
||||
->color('success')
|
||||
->icon(null),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user