Exporter
Use exports in the dashboard
Start an export from the resource you want to extract, then inspect its entry in the project's Exports area. Confirm the selected population and fields before starting. Queuing an export is separate from producing its file; wait for completion before using the download link. For a batch-operation change log, start its export from Batch Operations and retrieve the completed file from Exports.
Access to an export depends on the exporter's declared permission. Having access to the export list does not establish permission to open every export or download its contents. Keep the current team and project consistent with the export you are inspecting.
Admin and attendee export lists
The project export hub is /p/{team}/{project}/exports on the dashboard host. Its Admin Exports and Attendee Exports tabs use separate log and detail routes. Attendee exports are delivered through their supported secure portal links; to extract attendee data as an administrator, start the appropriate admin export from the owning resource. Do not substitute an attendee-export log ID for an admin-export log ID.
Inspect the selected export's type, initiator, project, completion state and available file before requesting a download. A list row is not a ready file or permission grant. The reviewed project list controller delegates to its listing service without an explicit policy call; detail, cancellation and download paths have their own checks. Test list visibility and each sensitive download with allowed and excluded principals in the deployment rather than treating the list UI as an authorization boundary.
Cancel a pending export
The project cancellation endpoint changes only an export whose status is pending. It requires export-view authorization, matching team and project, and either the initiating admin or a super admin. Calling it for an export already in another state returns its current state; it does not establish that running work was stopped or a completed file was removed.
For backup exports associated with a bulk update, cancellation can make rollback unavailable. Confirm the backup state before cancelling and preserve any recovery evidence you still need. A completed, failed or cancelled response is terminal for status tracking, but only completed responses provide a download URL through this endpoint.
Overview
The GXP export system is built on top of Maatwebsite Excel with a layer of custom interfaces, traits, and jobs that provide:
- Logging and audit trail -- the standard admin finalizer records exports in
export_logswith admin, team/project and supplied field/sensitivity metadata. Attendee exports use their separate log. - Privacy controls -- field selection uses export permissions. The download service separately rechecks permissions for exports marked as containing PII or decrypted encrypted data; it does not perform a separate private-field permission check.
- Content bundling -- exports that include files (images, videos, documents) are packaged into ZIP archives alongside the spreadsheet data.
- Batch/multi-sheet exports -- a single XLSX workbook can contain sheets from multiple child exporters.
- Download security -- signed temporary URLs with sensitivity-based expiry, count limits, and permission checks when requesting a download URL.
- Cleanup -- a scheduled job (
CleanupExpiredExportsJob) deletes files after their retention window plus a grace period.
Supported output formats: XLSX, CSV, and ZIP (for content exports).
Export Interfaces and Traits
BaseExport Interface
App\Exports\Concerns\BaseExport
Every exporter must implement this interface. It defines the identity and permission contract for the export.
interface BaseExport
{
public function getFilename(): string;
public function getExportType(): string;
public static function getPermission(): string;
public static function exportDisplayName(): string;
}
| Method | Purpose |
|---|---|
getFilename() | Returns the generated filename (usually includes a timestamp and format extension). |
getExportType() | Returns a slug used in the export_logs.export_type column (e.g. 'attendees', 'team-members'). |
getPermission() | Returns the permission string required to run this export. Used for authorization checks. |
exportDisplayName() | Human-readable name shown in notifications and the export log UI (e.g. 'Team Members Export'). |
ContentExport Interface
App\Exports\Concerns\ContentExport
Extends BaseExport. Used for exports that bundle files (images, documents, videos) alongside spreadsheet data into a ZIP archive.
interface ContentExport extends BaseExport
{
public function query();
/**
* Define a custom query for content extraction.
* Defaults to main query() if not implemented.
*/
public function contentQuery();
public function getContentFilePath($record, $col = null): ?string;
public function getContentFileName($record, $col = null): ?string;
public function getContentSubfolderName($column): string;
}
| Method | Purpose |
|---|---|
query() | The primary Eloquent query for spreadsheet rows (standard Maatwebsite FromQuery). |
contentQuery() | Query for records that have files to bundle. Defaults to query() if not overridden. |
getContentFilePath($record, $col) | Returns the selected storage path. The default trait prefers a recorded HD video path; it does not check existence or guarantee fallback. |
getContentFileName($record, $col) | Returns the ZIP entry filename. The default timestamp transformation does not guarantee unique names. |
getContentSubfolderName($column) | Returns the subfolder name within the ZIP for organizing files (e.g. 'files', 'images', 'uploads'). |
BatchExport Interface
App\Exports\Concerns\BatchExport
Extends BaseExport. Used for multi-sheet workbook exports where each sheet comes from a separate child exporter.
interface BatchExport extends BaseExport
{
/**
* Returns an array of child exporter instances.
*/
public function getChildExports(): array;
}
Each child export must implement FromQuery, WithHeadings, WithMapping, and provide a title() method that returns the sheet tab name.
Traits
ExportManager
App\Exports\ExportManager
Core orchestration trait for standard admin exports. Provides the generateExport() method that handles the full store-and-chain pattern.
trait ExportManager
{
public function generateExport(Admin $admin): void
{
$requestingHost = request()->getHost();
$format = 'xlsx';
$filename = $this->getFilename($format);
$storagePath = $this->getExportStoragePath($filename);
$disk = config('excel.disk');
$exportInfo = [
'filename' => $filename,
'file_path' => $storagePath,
'export_type' => $this->getExportType(),
'export_format' => $format,
'storage_disk' => $disk,
'export_class' => self::class,
];
$this->store($storagePath, $disk)->chain([
new FinalizeExport($exportInfo, $admin, $this->team ?? null, $this->project ?? null, null, $requestingHost),
]);
}
public function getExportStoragePath(string $filename, ?string $objectKey = null): string
{
$basePath = config('excel.base_path');
$segment = ($objectKey === null || $objectKey === '') ? Str::random(10) : $objectKey;
$className = Str::of(get_class($this))->afterLast('\\')->before('Export')->snake();
return "$basePath/$className/$segment/$filename";
}
}
By default, storage paths follow {base_path}/{class_slug}/{random_10_chars}/{filename}. The path helper also accepts a caller-supplied object key; the workflow export step uses that option for stable retry paths. This does not by itself make the complete export pipeline idempotent. The trait excerpt assumes the source imports for Admin, FinalizeExport and Str.
Usage: use Exportable, ExportManager; on your exporter class, then call $export->generateExport($admin) from the controller.
ContentExportable
App\Exports\Concerns\ContentExportable
Dispatches ContentExporterJob to bundle spreadsheet data and files into a ZIP archive.
<?php
namespace App\Exports\Concerns;
use App\Jobs\ContentExporterJob;
use Illuminate\Support\Str;
trait ContentExportable
{
public $filename;
public $filePath;
protected array $contentColumns;
/**
* Query for fetching records with files/attachments.
* Override to use a different model or scope.
*/
public function contentQuery()
{
return $this->query();
}
/**
* Store the export using a specified filename and dispatch the job for processing.
*
* @param string $filePath Path used to store the exported content.
*/
public function exportContent(string $filePath, array $columns)
{
// Set the filename in the exporter
$this->filePath = $filePath;
// get filename from path
$this->filename = basename($filePath);
$this->contentColumns = $columns;
// Dispatch the job to handle the export process.
return dispatch(new ContentExporterJob($this));
}
public function getContentFilePath($record, $col = null): ?string
{
$columnName = $col ?? $this->contentColumns[0];
$filePath = $record->path($columnName);
$fileMime = $record->mime($columnName);
if ($fileMime && Str::startsWith($fileMime, 'video/')) {
$hdFilePath = $record->path($columnName.'_fhd');
if ($hdFilePath) {
return $hdFilePath;
}
}
return $filePath;
}
public function getContentFileName($record, $col = null): ?string
{
$columnName = $col ?? $this->contentColumns[0];
$createdAt = $record->created_at->format('YmdHis');
$filename = $record->fileName($columnName);
$fileMime = $record->mime($columnName);
$fileExtension = Str::afterLast($fileMime, '/');
$filename = Str::replace('.'.$fileExtension, '_'.$createdAt.'.'.$fileExtension, $filename);
// if Mime starts with video/ then we need to get the hd filename
if ($fileMime && Str::startsWith($fileMime, 'video/')) {
$hdFilenameMime = $record->mime($columnName.'_fhd');
if ($hdFilenameMime) {
$hdFilenameExtension = Str::afterLast($hdFilenameMime, '/');
// replace $fileMime with $hdFilenameMime
$filename = Str::replace('.'.$fileExtension, '.'.$hdFilenameExtension, $filename);
}
}
return $filename;
}
public function getContentColumns(): array
{
return $this->contentColumns;
}
}
The default resolvers require at least one content column and records that implement path(), mime() and fileName(), with a date-like created_at supporting format(). The job also calls each record's disk(). Override the resolvers/query when exporting another record shape; merely implementing the interface does not supply compatible file records.
Key behaviors:
- Video path selection prefers a nonempty
_fhdpath supplied by the record. It does not verify that file exists before choosing it. - Filenames add the record creation timestamp where the MIME-derived extension matches; this is not a unique identifier or a guarantee against ZIP name collisions.
- The
$contentColumnsarray identifies which model columns contain file references.
BatchExportable
App\Exports\Concerns\BatchExportable
Dispatches BatchExportJob for multi-sheet workbook generation.
trait BatchExportable
{
public function batchExport($storagePath, $disk)
{
return BatchExportJob::dispatch($this, $storagePath, $disk);
}
}
AttendeeExportManager
App\Exports\AttendeeExportManager
Attendee-specific export orchestration with support for both CSV exports and ZIP content exports. Chains with FinalizeAttendeeExport instead of FinalizeExport since the recipient is an attendee, not an admin.
trait AttendeeExportManager
{
public function generateExport(Attendee $attendee, bool $useAlternativeEmail = false)
{
$exportInfo = $this->buildExportInfo('csv');
$this->store($exportInfo['file_path'], $exportInfo['storage_disk'])->chain([
new FinalizeAttendeeExport($exportInfo, $attendee, $this->team ?? null, $this->project ?? null, $useAlternativeEmail),
]);
}
public function generateContentExport(Attendee $attendee, bool $useAlternativeEmail = false)
{
$exportInfo = $this->buildExportInfo('zip');
$this->exportContent($exportInfo['file_path'], ['saved_value'])->chain([
new FinalizeAttendeeExport($exportInfo, $attendee, $this->team ?? null, $this->project ?? null, $useAlternativeEmail),
]);
}
}
Storage paths use: {base_path}/attendee/{class_slug}/{random_10_chars}/{filename}.
Creating a New Exporter
Step 1: Create the Export Class
This example defines a new project-scoped exporter for attendee identifiers. It illustrates the extension contract; it does not replace the built-in AttendeesExport, which supports richer field selection and privacy metadata. Keep sensitive fields out of this minimal example unless you also implement the appropriate selection and export metadata controls.
<?php
namespace App\Exports;
use App\Exports\Concerns\BaseExport;
use App\Models\Project;
use App\Models\Team;
use Illuminate\Contracts\Queue\ShouldQueue;
use Maatwebsite\Excel\Concerns\Exportable;
use Maatwebsite\Excel\Concerns\FromQuery;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithMapping;
class DocumentationAttendeeIdExport implements BaseExport, FromQuery, ShouldQueue, WithHeadings, WithMapping
{
use Exportable, ExportManager;
public function __construct(protected Team $team, protected Project $project) {}
public function query()
{
return $this->project->attendees()->orderBy('id');
}
public function headings(): array
{
return ['id', 'uuid'];
}
public function map($attendee): array
{
return [$attendee->id, $attendee->uuid];
}
public function getFilename($format = 'xlsx'): string
{
return 'attendee_ids_' . date('YmdHis') . '.' . $format;
}
public function getExportType(): string
{
return 'documentation-attendee-ids';
}
public static function getPermission(): string
{
return config('permissions.rules.attendee.viewAny');
}
public static function exportDisplayName(): string
{
return 'Attendee ID Export';
}
}
Step 2: Add the Controller Method
In a project controller, import App\Exports\DocumentationAttendeeIdExport, App\Models\Attendee, App\Models\Project and Illuminate\Http\Request. Use the authenticated dashboard route's resolved team/project context and authorize the operation before queueing:
public function export(Request $request, Project $project)
{
$this->authorize('viewAny', Attendee::class);
$team = $request->attributes->get('currentTeam');
abort_unless($team && (int) $project->team_id === (int) $team->id, 403);
$export = new DocumentationAttendeeIdExport($team, $project);
$export->generateExport($request->user());
return response()->json(['status' => 'queued']);
}
ExportManager creates the storage path and chains FinalizeExport with the requesting host. Returning queued is an acknowledgement of dispatch, not a completed file. Use the existing dashboard team/project access middleware when adding the route; the example's controller checks are not a replacement for it.
Step 3: Add the Route
Add a route to the appropriate route file (typically in routes/admin/ for project-scoped exports).
Standard Export Flow
The standard export lifecycle proceeds through these stages:
Controller
-> Authorize and scope the request
-> Instantiate exporter
-> Build $exportInfo array
-> Call store() to queue the Excel generation
-> Chain FinalizeExport job
-> Creates/updates ExportLog record
-> Calculates expiry based on sensitivity
-> Dispatches ExportStatusUpdated event (real-time UI update)
-> Sends ExportCompletedNotification to admin
-> Logs audit entry for sensitive exports
The $exportInfo array is the data contract between the controller and FinalizeExport:
$exportInfo = [
'filename' => $filename,
'file_path' => $storagePath,
'export_type' => $export->getExportType(),
'export_format' => 'xlsx', // 'xlsx', 'csv', or 'zip'
'storage_disk' => config('excel.disk'),
'export_class' => ExporterClass::class,
// Optional privacy fields:
'sensitivity_level' => 'pii', // 'standard', 'private', 'pii', 'encrypted'
'included_pii' => true,
'included_private' => false,
'included_encrypted'=> false,
'exported_field_slugs' => ['contact_email'],
'excluded_field_slugs' => ['private_notes'],
];
Content Exports
Content exports bundle files (images, videos, documents) alongside spreadsheet data into a ZIP archive.
How It Works
- The exporter implements
ContentExportand uses theContentExportabletrait. - Instead of calling
store(), the controller callsexportContent($filePath, $columns). - This dispatches
ContentExporterJobwhich:- Generates the spreadsheet data via
raw()(in-memory, avoiding nested queue dispatching). - Creates a
ZipArchiveon local temp storage. - Adds the spreadsheet as the first entry in the ZIP.
- Iterates through
contentQuery()in chunks of 25 records. - For each record, retrieves the file from its storage disk and adds it to the ZIP under the subfolder returned by
getContentSubfolderName(). - Moves the completed ZIP to final storage (the configured
excel.disk). - Cleans up temp files.
- Generates the spreadsheet data via
FinalizeExportis chained after to create the log and send the notification.
Controller Pattern
This fragment assumes an authenticated dashboard controller with resolved team, project and social-stream scope. Apply the existing resource authorization and scope checks before constructing the exporter. Use a unique storage path and pass the requesting host to the finalizer:
$export = new SocialStreamPostExport($team, $project, $socialStream);
$filename = $export->getFilename('zip');
$storagePath = config('excel.base_path') . '/social_stream_posts/'
. \Illuminate\Support\Str::uuid() . '/' . $filename;
$exportInfo = [
'filename' => $filename,
'file_path' => $storagePath,
'export_type' => $export->getExportType(),
'export_format' => 'zip',
'storage_disk' => config('excel.disk'),
'export_class' => SocialStreamPostExport::class,
];
$export->exportContent($storagePath, ['file_path'])->chain([
new FinalizeExport($exportInfo, request()->user(), $team, $project, null, request()->getHost()),
]);
ContentExporterJob Internals
- Timeout: 600 seconds (10 minutes).
- Memory limit: 8 GB.
- Processes content files in chunks of 25.
- Supports both queued and non-queued exporters.
- Automatically detects CSV vs XLSX format via
getExportFormat()method (defaults to XLSX). - The standard job passes no column argument to the file resolver and chooses the subfolder from the first content column. Supplying multiple column names does not make it bundle every attachment column per record.
- A missing path or missing stored file is skipped. A completed ZIP therefore does not prove every spreadsheet row has an attachment.
- The default trait prefers a recorded video
_fhdpath; if that path points to a missing file, the job skips it rather than falling back to the original. - The trait derives ZIP names from original filename/MIME and creation time. Review archive entries when records can share names and timestamps; no universal collision-free naming guarantee is provided.
Batch Exports
Batch exports create a single XLSX workbook with multiple sheets, each populated by a different child exporter.
How It Works
- The parent exporter implements
BatchExportand uses theBatchExportabletrait. - The controller calls
batchExport($storagePath, $disk)which dispatchesBatchExportJob. BatchExportJob:- Creates a single
PhpOffice\PhpSpreadsheet\Spreadsheetinstance. - Iterates through
getChildExports(). - For each child, creates a worksheet named by
$child->title()(limited to 31 characters and de-duplicated with numbered suffixes). - Writes headings, then chunks through the child's query in batches of 500.
- Writes the complete workbook to temp storage, then moves to final storage.
- Creates a single
FinalizeExportis chained after.
Example: BatchAttendeeCredentialScanExport
The existing parent accepts Project $project, optional bool $liveOnly = false and optional selected agenda-item IDs. It creates one credential-scan child per agenda location with an access zone; unzoned locations are omitted. Child construction failures are logged and skipped before workbook processing.
$export = new BatchAttendeeCredentialScanExport($project);
$children = $export->getChildExports();
This fragment queries child exporters; it does not authorize or dispatch an export. Use the batch dispatch and finalizer pattern in an authorized controller to produce a file. A null or empty selection is not a request for zero records: it leaves the default project selection active. liveOnly takes precedence over selected IDs and uses the current start/end window. Validate the intended population before dispatching.
BatchExportJob Internals
- Timeout: 900 seconds (15 minutes).
- Memory limit: 4 GB.
- Single try (
$tries = 1). - Sheet names are limited to 31 characters; repeated titles receive a numbered suffix while staying within that limit.
- A processing exception before any child has completed fails the job. Later child exceptions are logged and processing continues. A sheet created before that exception may remain in the workbook with partial data.
- A child missing
FromQueryorWithMappingis warned about after the sheet and headings have been added; a heading-only sheet can remain. - With no child exports, the job returns without producing a workbook. A caller-chained finalizer can still run after that normal return; the admin finalizer does not verify file existence before completing its log. Download validation can subsequently refuse the missing file. Check the expected child population and stored artifact rather than interpreting a completed log alone as proof of a workbook.
- Inspect expected sheet names and row counts before using a workbook operationally. Successful storage alone does not prove every intended sheet is complete.
Export Logging and Audit Trail
ExportLog Model
App\Models\ExportLog
The standard admin finalizer creates or completes an export_logs record. Attendee-initiated exports use a separate AttendeeExportLog. The admin model implements Auditable for change tracking.
| Field | Type | Description |
|---|---|---|
id | int | Primary key |
admin_id | int | The admin who initiated the export |
team_id | int | Team scope |
project_id | int (nullable) | Project scope (null for team-level exports) |
export_type | string | Export type slug (e.g. 'attendees', 'social_stream_posts') |
export_format | string | File format: 'xlsx', 'csv', or 'zip' |
filename | string | Generated filename |
file_path | string | Full storage path (set to '[DELETED]' after cleanup) |
storage_disk | string | Laravel filesystem disk name |
export_class | string | Fully qualified class name of the exporter |
status | string | Pending, processing, completed, failed or cancelled; finalization accepts pending/processing, although the reviewed finalizer notes that no current path writes processing |
error_message | string (nullable) | Error details when status is 'failed' |
sensitivity_level | string | 'standard', 'private', 'pii', or 'encrypted' |
included_pii | boolean | Recorded PII inclusion flag supplied to finalization |
included_private | boolean | Recorded private-field inclusion flag supplied to finalization |
included_encrypted | boolean | Recorded decrypted-field inclusion flag supplied to finalization |
exported_field_slugs | JSON array | Recorded selected/exported field slugs supplied by the exporter |
excluded_field_slugs | JSON array | Recorded excluded field slugs supplied by the exporter |
download_expires_at | datetime | When application-authorized download availability expires; distinct from each signed URL expiry |
max_downloads | int (nullable) | Recorded URL-request limit (null means unlimited) |
download_count | int | Recorded count of allowed URL requests, not confirmed transfers |
skip_notification | boolean | Stored flag; the reviewed FinalizeExport completion path does not consult it |
created_at | datetime | When the export log was created; some paths create it before work and others during finalization |
Key model methods (signatures, not executable invocation examples):
| Method | Return type | Scope |
|---|---|---|
isExpired() | bool | Recorded availability timestamp |
isDownloadLimitReached() | bool | Recorded count versus configured record limit |
containsSensitiveData() | bool | PII, encrypted or private flags |
canBeDownloaded() | bool | Expiry and count only |
getDownloadBlockReason() | ?string | Expiry or count explanation |
incrementDownloadCount() | void | Increment the recorded count |
canBeDownloaded() does not check storage existence, user permissions or completion status. Use the authorized download service path to request access; this helper alone is not an access decision.
Scopes:
ExportLog::sensitive() // Where included_pii OR included_encrypted OR included_private
ExportLog::notExpired() // Where download_expires_at is null or in the future
ExportLog::bySensitivity($level) // Filter by sensitivity_level
Relationships: admin(), team(), project(), exportLogDownloads().
ExportLogDownload Model
App\Models\ExportLogDownload
Attempts that reach ExportService::getSignedUrl() log their validation result in export_log_downloads. A policy rejection before the service is called does not pass through this logging path. A successful record means URL issuance was allowed; it does not confirm that the storage transfer finished.
| Field | Type | Description |
|---|---|---|
id | int | Primary key |
export_log_id | int | FK to export_logs |
admin_id | int | The admin who attempted the download |
ip_address | string (nullable) | Client IP address |
user_agent | string (nullable) | Client user agent string |
had_pii_permission | boolean | Whether the admin had PII export permission at download time |
had_encrypted_permission | boolean | Whether the admin had encrypted export permission at download time |
status | string | Download outcome (see constants below) |
block_reason | string (nullable) | Human-readable reason when blocked |
Status constants:
ExportLogDownload::STATUS_SUCCESS = 'success'
ExportLogDownload::STATUS_BLOCKED_PERMISSION = 'blocked_permission'
ExportLogDownload::STATUS_BLOCKED_EXPIRED = 'blocked_expired'
ExportLogDownload::STATUS_BLOCKED_LIMIT = 'blocked_limit'
ExportLogDownload::STATUS_BLOCKED_NOT_FOUND = 'blocked_not_found'
Scopes: successful(), blocked(), joinedWithAdmin().
Privacy and Permission Controls
ExportPermissionService
App\Services\ExportPermissionService
Centralizes permission checks for sensitive field exports. Each check cascades through three levels: team permission, project permission, then global permission.
| Method | Return type |
|---|---|
canExportPii(Admin $admin, Project $project) | bool |
canExportEncrypted(Admin $admin, Project $project) | bool |
canExportPrivate(Admin $admin, Project $project) | bool |
getAvailableOptions(Admin $admin, Project $project) | array |
getExportableFieldsWithMetadata(Admin $admin, Project $project) | array |
Permission keys are configured in config/attendee.php:
attendee.export.pii_permission-- defaults to'export-pii'attendee.export.encrypted_permission-- defaults to'export-encrypted'attendee.export.private_permission-- defaults to'export-private'
The canExportPrivate() check has a fallback: if the admin has PII export permission, they are also granted private field export permission.
Attendee field selection and sensitive options
The dashboard attendee export endpoint checks permission before accepting include_pii, include_private or decrypt_encrypted. A requested option without its permission returns 403. The exporter class itself consumes these options; code that constructs it directly must perform equivalent authorization rather than treating an option as permission.
Custom fields are selected from the project, filtered by export/visibility role rules when an admin is supplied, then filtered by the private/PII inclusion options and any selected field slugs. Fields excluded from exports are removed by the role scope. Field metadata is therefore about the eligible returned population, not an inventory of every field in the project.
selected_fields narrows custom fields when it is nonempty; it does not by itself whitelist standard columns. Standard columns have separate exclude_standard_fields controls, and a nonempty column_order also acts as their whitelist while controlling headings. Verify the actual headings before distributing the file, especially when extending exports in server code.
For example, when the project has an eligible custom field with slug company, this request fragment selects it and limits the standard columns to id and uuid:
{
"selected_fields": ["company"],
"column_order": ["id", "uuid", "company"],
"include_private": false,
"include_pii": false,
"decrypt_encrypted": false
}
column_order orders the resulting columns and whitelists standard fields. Eligible custom fields selected through selected_fields but omitted from column_order are appended at the end; the order list is not a custom-field exclusion control. Unavailable or unauthorized custom fields do not become exportable just because their slug appears in this fragment.
For an eligible encrypted field, leaving decryption disabled exports [ENCRYPTED]. Enabled decryption uses the encryption service; a caught decryption error produces [DECRYPTION_ERROR] and is reported. These markers are not the original value and should not be treated as valid input for a restoration import.
The attendee export metadata records custom-field slugs and the requested inclusion/decryption flags. It does not inspect the finished workbook to prove how many sensitive values were emitted. Standard columns and actual file contents must be checked separately when evaluating an export.
Sensitivity Levels
Sensitivity levels determine download URL expiry duration, file retention period, and maximum download counts. They are defined as constants on ExportLog:
| Level | Constant | Description |
|---|---|---|
standard | SENSITIVITY_STANDARD | Standard classification; longest default availability. |
private | SENSITIVITY_PRIVATE | Classification for private-field exports. |
pii | SENSITIVITY_PII | Classification for PII exports. |
encrypted | SENSITIVITY_ENCRYPTED | Classification for decrypted-field exports; shortest default availability and lowest finite limit. |
Retention and download limits are configured in config/attendee.php under export_urls.file_retention and export_urls.max_downloads, keyed by sensitivity level.
Field-Level Export Filtering
getExportableFieldsWithMetadata() returns each field with its exportability status based on the admin's permissions:
[
'fields' => [
['slug' => 'email', 'name' => 'Email', 'is_pii' => true, 'exportable' => true, 'decryptable' => false],
// ...
],
'has_pii_fields' => true,
'has_private_fields' => false,
'has_encrypted_fields' => true,
'permissions' => [
'can_export_pii' => true,
'can_export_encrypted' => false,
'can_export_private' => true,
],
]
Download Security
Downloads go through ExportController@download, which delegates to ExportService.
ExportService Flow
App\Services\ExportService
Admin requests download
-> ExportController authorizes via Policy
-> ExportService::getSignedUrl() called
-> validateDownload() runs 5 checks:
1. File exists on storage disk
2. Export has not expired (download_expires_at)
3. Download limit not reached (max_downloads)
4. PII permission re-validated (if export included PII)
5. Encrypted permission re-validated (if export included encrypted data)
-> logDownloadAttempt() records the attempt (success or failure)
-> If allowed: incrementDownloadCount(), generate signed URL
-> If blocked: throw exception with reason
Download troubleshooting
| Symptom | What to check |
|---|---|
| File no longer exists | Check export retention and storage availability. The log can remain after the file is removed; create a new export if appropriate. |
| Export expired | The export's availability window has ended. Reopening the same link does not extend it. |
| Maximum download limit reached | The service increments the count when it allows a signed URL request, before generating the URL. The count is not a count of confirmed completed transfers. |
| PII or decrypted-data permission denied | Check current project permissions and the export's recorded sensitivity flags. Permission at creation time does not guarantee later access. |
| Previously issued link stops working | Signed storage/CDN URLs have their own expiry. Request a new link through the authorized dashboard while the export remains eligible. |
For JSON download requests, the controller returns a url on success and a 403 error/message for service exceptions. Other service failures redirect to the export list with an error. Permission is checked by the application when issuing the URL; this path does not reauthorize every subsequent storage request using that already issued URL. Keep exported sensitive files and links within their intended audience.
Signed URL Generation
URLs are time-limited based on sensitivity level, configured in config/attendee.export_urls.expiry:
protected function generateSignedUrl(ExportLog $exportLog): string
{
$urlExpiry = config('attendee.export_urls.expiry');
$expiryMinutes = $urlExpiry[$exportLog->sensitivity_level] ?? $urlExpiry['standard'] ?? 60;
if (config('filesystems.use_app_urls')) {
return $this->generateCdnSignedUrl($exportLog, $expiryMinutes);
}
return Storage::disk($exportLog->storage_disk)->temporaryUrl(
$exportLog->file_path,
now()->addMinutes($expiryMinutes),
['ResponseContentDisposition' => 'attachment; filename="' . $exportLog->filename . '"']
);
}
Two URL generation strategies:
- Cloud Storage temporary URLs (default) -- uses the storage driver's
temporaryUrl()(e.g., GCS signed URLs). - CDN signed URLs -- when
filesystems.use_app_urlsis true, generates HMAC-signed Cloud CDN URLs using a key name and base64url-encoded key from config.
Job Pipeline
FinalizeExport
App\Jobs\FinalizeExport
Used by the standard admin store-and-chain export path. It records export availability and then performs completion notifications, broadcasts and sensitive-export auditing.
Constructor: FinalizeExport(array $exportInfo, Admin $admin, ?Team $team = null, ?Project $project = null, ?int $exportLogId = null, ?string $requestingHost = null, ?array $workflowContext = null)
Pass the requesting host for correct dashboard links on mask domains. The optional workflow context belongs to workflow-dispatched exports; ordinary callers leave it null.
Completion behavior:
- Calculates export availability and maximum URL-request counts from the recorded sensitivity and configuration.
- For an existing export log, completes only a row still pending or processing. It preserves a cancelled, failed or already completed settlement, including the existing expiry and counters.
- For the ordinary path without an existing log ID, creates a new log. Do not assume that this separate creation path has the same retry identity guarantees as an existing-log transition.
- Records outstanding completion effects with the completion write, then performs status broadcast, admin notification and sensitive-export audit in tracked stages. A completed log and delivery of its notification are separate facts.
- Workflow exports report the stored outcome to the waiting workflow. This is separate from delivery of email or realtime updates.
Failure and recovery: A cancelled export stays cancelled. A failure after the row was completed does not downgrade it to failed; the finalizer attempts to finish outstanding completion effects. Before completion, a resolvable log can be marked failed and retain an error. If no log can be resolved, there may be no export row to inspect even though the job failed.
Completion effects use a claim and recorded stage to resume unfinished work. A crash after an external effect but before its stage is recorded can repeat that effect. Treat notifications as delivery attempts, not an exactly-once guarantee. If a completed export has no notification, inspect its dashboard state before creating another export; worker recovery procedures remain in the private operational documentation.
FinalizeAttendeeExport
App\Jobs\FinalizeAttendeeExport
Attendee exports use a separate AttendeeExportLog and notification path. The finalizer creates that log before finding a ready email template with system role and attendee-export target. Template lookup checks the project first, then team templates without a project, then public templates. If none is available, it logs the missing template and returns; the existence of an export log does not prove an email was sent.
The required template values are role=system (ROLE_SYSTEM), role_target=attendee_export (ROLE_TARGET_ATTENDEE_EXPORT), type=email (TYPE_EMAIL) and status=ready (STATUS_READY). Attach a domain through the project's portal domain controls (Attach Domain). Domain selection uses the default portal, falling back to an active portal; within it, a default domain is preferred, then an active domain, then its first domain. A default portal is not automatically provisioned for every project plan.
The notification receives export.link and export.display_name, then dispatches SendCustomNotificationJob. Configure and publish the applicable template before expecting attendee email delivery. Alternative-email behavior is selected by the caller's useAlternativeEmail flag; dispatch is not a delivery receipt.
The attendee link is a 24-hour signed portal download route based on a configured portal domain. If the project cannot resolve a portal domain, link generation throws and notification cannot proceed. Admin signed-storage URL durations in the retention table are a separate path and do not describe this portal link. Validate portal access and email delivery in the target environment before relying on attendee exports.
Opening the signed attendee portal link resolves the attendee from the export record. This route uses signed-link middleware and does not add an attendee-login requirement at the route declaration. Treat the link as access to that export: the download page can show its filename and attendee identity details.
The page requests a second signed storage/CDN URL lasting five minutes. The attendee service checks file existence and records link issuance, then signs the file URL. It does not apply the admin service's export-expiry, download-limit or PII/decryption permission checks. A tracking row confirms URL issuance, not that the recipient completed a download. If the underlying file is unavailable, the portal page shows an error rather than a usable download.
This finalizer does not use the admin finalizer's tracked completion-effect stages. Do not assume the same retry, deduplication or recovery guarantees apply across the two implementations.
ContentExporterJob
App\Jobs\ContentExporterJob
Processes content exports by creating a ZIP archive containing both the spreadsheet and associated files.
- Timeout: 600 seconds.
- Memory: 8 GB.
- Generates spreadsheet via
raw()to avoid nested job dispatching. - Iterates
contentQuery()in chunks of 25. - Files are read from each record's storage disk and written to a subfolder in the ZIP.
- ZIP is built on local temp storage, then moved to final storage.
BatchExportJob
App\Jobs\BatchExportJob
Processes batch (multi-sheet) exports using PhpSpreadsheet directly.
- Timeout: 900 seconds.
- Memory: 4 GB.
- Single try (
$tries = 1). - Creates one
Worksheetper child export. - Chunks query results in batches of 500.
- Writes the complete workbook once, then moves to final storage.
- Cleans up temp files in a
finallyblock.
BatchContentExporterJob
App\Jobs\BatchContentExporterJob
An internal helper with offset/limit arguments that reads records and writes individual content files to a temporary destination. It is separate from the standard ContentExporterJob ZIP path. No dispatch call was found in the reviewed application/routes scope; do not use this class reference as evidence that parallel attachment export is an available dashboard feature. The standard content contract and tested archive behavior are described above.
CleanupExpiredExportsJob
App\Jobs\CleanupExpiredExportsJob
Removes stored files after the export availability window plus a grace period. The reviewed scheduler queues this job daily at 03:30 in its configured timezone, with a seven-day grace period and overlap/single-server guards. Actual cleanup depends on the scheduler, worker and storage being available.
The job selects records with a non-null download_expires_at older than the grace threshold and a non-null file path that is not already marked [DELETED]. It deletes an existing file and replaces the log's file_path with [DELETED], preserving the export record. An already missing file is also marked deleted. Exceptions are reported and processing continues with other exports.
The grace period does not extend permission to download an expired export. Attendee bulk-update rollback follows a separate import path: it checks export-view/import-create authorization, project/team ownership and reads the stored backup directly rather than requesting a signed download URL. Download expiry alone therefore does not determine rollback eligibility. Cancelled backups or missing files still prevent recovery, and the resulting import requires review. See bulk action recovery. A retained log is evidence of an export record, not proof that its file is still available. Storage lifecycle rules can also affect availability independently of this job.
The reviewed configuration defaults are:
| Sensitivity | Signed URL duration | Export availability window | URL-request limit |
|---|---|---|---|
| Standard | 60 minutes | 90 days | Unlimited |
| Private | 30 minutes | 30 days | Unlimited |
| PII | 15 minutes | 7 days | 25 |
| Encrypted | 5 minutes | 1 day | 5 |
These are configuration defaults, not a promise for every deployment. URL duration and sensitive download limits can be overridden by configuration/environment. Finalization records the calculated export expiry and limit; changing configuration does not automatically rewrite existing records.
CloudStorageExportJob / CloudStorageExportFinalizeJob
A separate social-stream file export pipeline using Google Drive, the cloud-storage queue and sync-to-google-drive rate limiting. CloudStorageExportService batches per-post jobs with failures allowed and dispatches finalization from the batch's final callback. Reaching finalization does not prove every upload succeeded.
The finalizer calculates success from stored file IDs for the destination folder. Its failure count considers requested posts that still have a non-null file path; its total reflects the requested ID list. These numbers need not sum when records disappear or lose their files. Inspect per-post errors and destination contents before treating a completion notification as a complete export.
This path manages integration sync flags and ephemeral-token cleanup separately from admin ExportLog completion. A missing token or a post without a file can return from a per-post job without uploading. Use the integration's supported setup and result diagnostics; standard workbook/archive completion does not establish remote Drive delivery.
Existing Exporters
The table includes the current top-level exporter classes. Formats describe usual/default output, not a guarantee that every caller exposes every format or resource. Some classes serve internal/reporting paths; their presence does not establish a public API endpoint.
| Class | Export Type | Interface | Traits | Format |
|---|---|---|---|---|
AccessPointExport | access-zones | BaseExport | Exportable | XLSX |
AiSessionAnalyticsExport | ai-session-analytics | BaseExport | Exportable | XLSX |
AiSessionMessageContentExport | ai-session-message-content | ContentExport | ContentExportable, Exportable | ZIP |
AiSessionMessageExport | ai-session-messages | BaseExport | Exportable | XLSX |
AttendeeCredentialScanExport | agenda_location_scans | BaseExport | Exportable | XLSX |
AttendeeCredentialsExport | attendee-credentials | BaseExport | Exportable | XLSX |
AttendeeFormResponseExport | my-form-responses | BaseExport, ContentExport | AttendeeExportManager, ContentExportable, Exportable | CSV/ZIP |
AttendeesExport | attendees | BaseExport | Exportable | XLSX |
BatchAttendeeCredentialScanExport | agenda_location_scans | BatchExport | BatchExportable, Exportable | XLSX (multi-sheet) |
BulkActionLogExport | bulk-action-log | BaseExport | Exportable | XLSX |
NotificationDeliveryEngagementExport | engagement_report | BaseExport | Exportable, ExportManager | XLSX |
NotificationDeliveryReportExport | notifications | BaseExport | Exportable | XLSX |
NotificationDeliveryStatsExport | delivery_stats | BaseExport | Exportable, ExportManager | XLSX |
PointTransactionsExport | point-transactions | BaseExport | Exportable | XLSX |
ProjectActivityExport | project-activity | BaseExport | Exportable | XLSX |
ProjectFormResponseAnalyticsExport | attendee-form-responses-analytics | BaseExport | Exportable | XLSX |
ProjectFormResponseExport | attendee-form-responses | BaseExport | Exportable | XLSX |
PromoCodeExport | promo-codes | BaseExport | Exportable | XLSX |
QuizAttemptContentExport | quiz-attempts-with-images | ContentExport | ContentExportable, Exportable | ZIP |
QuizAttemptExport | quiz-attempts | BaseExport | Exportable | XLSX |
SocialStreamPostDataExport | social_stream_posts | ContentExport | ContentExportable, Exportable | ZIP (queued) |
SocialStreamPostExport | social_stream_posts | ContentExport | ContentExportable, Exportable | ZIP |
TeamMembersExport | team-members | BaseExport | Exportable | XLSX |
| AccessPointScanExport | access_zone_scans | BaseExport | Exportable | XLSX default |
| ActivityExport | activity | BaseExport | Exportable, ExportManager | XLSX default |
| AgendaEnrollmentOverviewExport | agenda_enrollment_overview | BaseExport | Exportable, ExportManager | XLSX default |
| AgendaItemEnrollmentExport | agenda_item_enrollments | BaseExport | Exportable, ExportManager | XLSX default |
| AgendaItemsExport | agenda-items | BaseExport | Exportable | XLSX default |
| AttendeeScheduleExport | attendee_schedule | BaseExport | Exportable, ExportManager | XLSX default |
| CohortEventsExport | cohort-events | BaseExport | Exportable, ExportManager (inherited) | XLSX default |
| CohortExport | cohort | BaseExport | Exportable, ExportManager | XLSX default |
| CollectionEntriesExport | collection-entries | BaseExport | Exportable, ExportManager | XLSX default |
| GroupsExport | groups | BaseExport | Exportable | XLSX default |
| JourneyEventsExport | journey-events | BaseExport | Exportable, ExportManager (inherited) | XLSX default |
| LocationsExport | locations | BaseExport | Exportable, ExportManager | XLSX default |
| ProjectTagsExport | project-tags | BaseExport | Exportable | XLSX default |
| PushDeliveryLogExport | push-delivery-log | BaseExport | Exportable, ExportManager | XLSX default |
| SavedSearchesExport | saved-searches | BaseExport | Exportable, ExportManager | XLSX default |
Key Files Reference
Interfaces and Traits
| File | Purpose |
|---|---|
app/Exports/Concerns/BaseExport.php | Base interface: filename, export type, permission, display name |
app/Exports/Concerns/ContentExport.php | Content export interface: content queries and file path resolution |
app/Exports/Concerns/ContentExportable.php | Trait: dispatches ContentExporterJob, handles file path/name logic |
app/Exports/Concerns/BatchExport.php | Batch export interface: getChildExports() |
app/Exports/Concerns/BatchExportable.php | Trait: dispatches BatchExportJob |
app/Exports/ExportManager.php | Trait: standard admin export orchestration (store + chain FinalizeExport) |
app/Exports/AttendeeExportManager.php | Trait: attendee export orchestration (CSV/ZIP + chain FinalizeAttendeeExport) |
Models
| File | Purpose |
|---|---|
app/Models/ExportLog.php | Export audit log with sensitivity, expiry, and download tracking |
app/Models/ExportLogDownload.php | Download attempt log with permission snapshots |
Services
| File | Purpose |
|---|---|
app/Services/ExportService.php | Download validation, signed URL generation, download logging |
app/Services/ExportPermissionService.php | PII/encrypted/private field permission checks |
Jobs
| File | Purpose |
|---|---|
app/Jobs/FinalizeExport.php | Creates ExportLog, sends notification, audits sensitive exports |
app/Jobs/FinalizeAttendeeExport.php | Creates AttendeeExportLog, sends email to attendee |
app/Jobs/ContentExporterJob.php | Builds ZIP with spreadsheet + content files |
app/Jobs/BatchExportJob.php | Builds multi-sheet XLSX workbook |
app/Jobs/BatchContentExporterJob.php | Processes a batch slice of content files |
app/Jobs/CleanupExpiredExportsJob.php | Deletes expired export files from storage |
app/Jobs/CloudStorageExportJob.php | Exports individual posts to Google Drive |
app/Jobs/CloudStorageExportFinalizeJob.php | Finalizes cloud storage batch export |
Controllers
| File | Purpose |
|---|---|
app/Http/Controllers/Admin/ExportController.php | Export index, show, and secure download endpoints |