Skip to content

Commit 22ddf48

Browse files
committed
ExportProcessor updates
1 parent 1a61adb commit 22ddf48

1 file changed

Lines changed: 24 additions & 3 deletions

File tree

README.md

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,21 +351,42 @@ returns the processor class you just created.
351351
```php
352352
namespace App\Nova\Exports;
353353

354-
use Coreproc\NovaDataSync\Export\Jobs\ExportProcessor;
355354
use Coreproc\NovaDataSync\Export\Nova\Action\ExportNovaAction;
356355

357-
class UserExportAction extends ExportNovaAction
356+
class ProductExportAction extends ExportNovaAction
358357
{
359358
protected function processor(ActionFields $fields, Collection $models): ExportProcessor
360359
{
361-
return new UserExportProcessor();
360+
return new ProductExportProcessor();
362361
}
363362
}
364363
```
365364

366365
If you have additional fields that you want to add to the Export feature, you can define them in the `fields()` method
367366
and access them through the `$fields` property.
368367

368+
```php
369+
namespace App\Nova\Exports;
370+
371+
use Coreproc\NovaDataSync\Export\Nova\Action\ExportNovaAction;
372+
373+
class ProductExportAction extends ExportNovaAction
374+
{
375+
protected function processor(ActionFields $fields, Collection $models): ExportProcessor
376+
{
377+
return new ProductExportProcessor($fields->get('start_date'), $fields->get('end_date'));
378+
}
379+
380+
public function fields(NovaRequest $request): array
381+
{
382+
return [
383+
Date::make('Start Date')->required(),
384+
Date::make('End Date')->required(),
385+
];
386+
}
387+
}
388+
```
389+
369390
Now, you can add the `ExportNovaAction` to your Nova Resource:
370391

371392
```php

0 commit comments

Comments
 (0)