All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 1m4s
60 lines
2.0 KiB
PHP
60 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Exports;
|
|
|
|
use App\Models\StickerMappingMaster;
|
|
use Filament\Actions\Exports\ExportColumn;
|
|
use Filament\Actions\Exports\Exporter;
|
|
use Filament\Actions\Exports\Models\Export;
|
|
|
|
class StickerMappingMasterExporter extends Exporter
|
|
{
|
|
protected static ?string $model = StickerMappingMaster::class;
|
|
|
|
public static function getColumns(): array
|
|
{
|
|
static $rowNumber = 0;
|
|
return [
|
|
ExportColumn::make('no')
|
|
->label('NO')
|
|
->state(function ($record) use (&$rowNumber) {
|
|
// Increment and return the row number
|
|
return ++$rowNumber;
|
|
}),
|
|
ExportColumn::make('plant.name')
|
|
->label('PLANT'),
|
|
ExportColumn::make('item.code')
|
|
->label('ITEM CODE'),
|
|
ExportColumn::make('sticker1')
|
|
->label('STICKER LABEL 1'),
|
|
ExportColumn::make('sticker2')
|
|
->label('STICKER LABEL 2'),
|
|
ExportColumn::make('sticker3')
|
|
->label('STICKER LABEL 3'),
|
|
ExportColumn::make('sticker4')
|
|
->label('STICKER LABEL 4'),
|
|
ExportColumn::make('sticker5')
|
|
->label('STICKER LABEL 5'),
|
|
ExportColumn::make('created_at')
|
|
->label('CREATED AT'),
|
|
ExportColumn::make('updated_at')
|
|
->label('UPDATED AT'),
|
|
ExportColumn::make('created_by')
|
|
->label('CREATED BY'),
|
|
ExportColumn::make('updated_by'),
|
|
ExportColumn::make('deleted_at'),
|
|
];
|
|
}
|
|
|
|
public static function getCompletedNotificationBody(Export $export): string
|
|
{
|
|
$body = 'Your sticker mapping master export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
|
|
|
|
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
|
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
|
|
}
|
|
|
|
return $body;
|
|
}
|
|
}
|