Exports API Reference
Zonvoir\ZonvoirTable\Export is a serializable export definition. Return exports from Table::exports() to expose export controls in the frontend payload.
| Item | Value |
|---|---|
| Class | Zonvoir\ZonvoirTable\Export |
| Implements | JsonSerializable |
| Traits | Conditionable, ConfiguresExport, ExecutesExport, SerializesExport |
| Factory methods | make(), create() |
Factory Methods
Section titled “Factory Methods”public static function make( ?string $label = null, ?string $filename = null, ?string $type = null, bool|callable|null $authorize = null, bool $limitToFilteredRows = false, bool $limitToSelectedRows = false, bool $queued = false, ?callable $using = null, array $meta = [], array $data = [], array $events = [],): selfcreate() accepts the same arguments and delegates to make().
Static Defaults
Section titled “Static Defaults”defaultLimitToFilteredRows()
Signature
public static function defaultLimitToFilteredRows(bool $enabled = true): void
Change the default filtered-row limit for new exports.
defaultLimitToSelectedRows()
Signature
public static function defaultLimitToSelectedRows(bool $enabled = true): void
Change the default selected-row limit for new exports.
defaultQueueName()
Signature
public static function defaultQueueName(?string $queue = null): void
Set the default queue name for queued exports.
defaultQueueDisk()
Signature
public static function defaultQueueDisk(?string $disk = null): void
Set the default queue disk for queued exports.
Configuration Methods
Section titled “Configuration Methods”key()
Signature
public function key(?string $key): self
Override the serialized export key.
keyName()
Signature
public function keyName(): string
Resolve the configured key or a slug of the label.
label()
Signature
public function label(?string $label): self
Set the export label.
filename()
Signature
public function filename(?string $filename): self
Set the generated filename.
type()
Signature
public function type(?string $type): self
Set the Excel writer type. Defaults to XLSX.
authorize()
Signature
public function authorize(bool|callable $authorize = true): self
Set static or callback authorization.
limitToFilteredRows()
Signature
public function limitToFilteredRows(bool $limit = true): self
Export the filtered query instead of the unfiltered base query.
limitToSelectedRows()
Signature
public function limitToSelectedRows(bool $limit = true): self
Export only selected row keys.
queue()
Signature
public function queue(?string $filename = null, ?string $disk = null, ?callable $withQueuedJob = null): self
Mark the export as queued.
withQueuedJob()
Signature
public function withQueuedJob(?callable $callback): self
Customize the queued job after it is created.
using()
Signature
public function using(?callable $callback): self
Provide custom export execution.
asDownload()
Signature
public function asDownload(bool $download = true): self
Configure whether execution returns a download.
redirect()
Signature
public function redirect(string|array|callable|null $to): self
Configure redirect behavior after export execution.
redirectToRoute()
Signature
public function redirectToRoute(string $route, array $parameters = []): self
Redirect to a Laravel route.
redirectBackWithDialog()
Signature
public function redirectBackWithDialog(?string $title = null, ?string $message = null): self
Redirect back with dialog metadata and disable direct download.
events()
Signature
public function events(array $events): self
Merge event metadata.
meta()
Signature
public function meta(array $meta): self
Merge arbitrary export metadata.
dataAttributes()
Signature
public function dataAttributes(array $data): self
Merge serialized data attributes.
Execution Methods
Section titled “Execution Methods”isAuthorized()
Signature
public function isAuthorized(Table $table): bool
Resolve static or callback authorization.
executeUsing()
Signature
public function executeUsing(Table $table, ExportRequest $request, Builder $query): mixed
Run the configured custom exporter callback.
hasCustomExporter()
Signature
public function hasCustomExporter(): bool
Check whether `using()` is configured.
isLimitedToFilteredRows()
Signature
public function isLimitedToFilteredRows(): bool
Inspect filtered-row limiting.
isLimitedToSelectedRows()
Signature
public function isLimitedToSelectedRows(): bool
Inspect selected-row limiting.
isQueued()
Signature
public function isQueued(): bool
Inspect queued mode.
shouldDownload()
Signature
public function shouldDownload(): bool
Inspect download behavior.
resolvedFilename()
Signature
public function resolvedFilename(): string
Resolve the download filename.
queueFilename()
Signature
public function queueFilename(): string
Resolve the queued filename.
queueDisk()
Signature
public function queueDisk(): ?string
Resolve the queue disk.
queueName()
Signature
public function queueName(): ?string
Resolve the queue name.
writerType()
Signature
public function writerType(): string
Resolve the Excel writer type.
queuedJob()
Signature
public function queuedJob(mixed $job): mixed
Apply the queued job callback.
redirectResponse()
Signature
public function redirectResponse(): ?RedirectResponse
Build the configured redirect response.
eventsDefinition()
Signature
public function eventsDefinition(): array
Return configured export events.
Serialization
Section titled “Serialization”SerializesExport::toArray() and jsonSerialize() expose the frontend metadata used by the Vue adapter. Table metadata includes exportEndpoint only when Table::exportsDefinition() is not empty.
See Exports for practical table examples.