Skip to content

Exports and Imports ​

Overview ​

app/Exports and app/Imports hold maatwebsite/excel (^3.1) classes. Only four export classes are used today, all for reports: the monthly workspace report, the weekly platform report, the workspace asset report, and the back-office inquiry list. The other exports and every import class come from the older lead-management (LM) and order modules and are not instantiated anywhere in app/ or routes/.

The current asset import (CSV to platform) does not use these classes. It runs through app/Jobs/Import/ProcessAssetImportJob.php and the commands under app/Console/Commands/Import, and writes its audit trail with App\Logging\ImportMigrationLogger (see Services).

Exports in use ​

ClassOutputTriggered byDelivery
MonthlyWorkspaceReportExportXLSX with 6 sheetssend:monthly-workspace-reports (MonthlyWorkspaceReports), scheduled monthlyOn(1, '09:00') America/Denver; also from the back-office operations panelExcel::raw(...) attached by SendMonthlyWorkspaceReportEmail as monthly_workspace_report_{suffix}.xlsx
WeeklyPlatformReportExportXLSX with 2 sheetssend:weekly-platform-report (SendWeeklyPlatformReport, options --startDate, --endDate), scheduled weekly()->mondays()->at('09:00') America/Denver; also from the operations panelAttached by SendWeeklyPlatformReportEmail as weekly_platform_report.xlsx
WorkspaceAssetReportExportXLSX, one sheetdam:export-asset-report (ExportWorkspaceAssetReport, options --workspace slug, --email, --memory), run by hand or from the operations panelExcel::raw(...) attached by SendAssetReportEmail as {slug}_asset_report_{Ymd_His}.xlsx
InquiriesExportXLSX or other extension stored on the Inquiry disk (public/upload/inquiry)GET /admin/subscription/export (Web/Subscription/InquiryController@export), back-officeReturns RestResponse::success with filename = config('app.export_url') + upload/inquiry/{file}

The operations panel is Web/OperationsController (GET /admin/operations, POST /admin/operations/run, GET /admin/operations/status). It maps form fields to the command options listed above.

Report flow ​

Recipients:

  • Monthly report: the workspace user_email, with a hard-coded BCC list, for each id in the command's hard-coded $workspaceIds (or only --workspace={id}). --email sends to that address only, without BCC. --from / --to (YYYY-MM) choose the period, --split sends one report per month; legacy --month, --year, --end-month still work.
  • Weekly platform report: a hard-coded $emails list in the command. Default period is the previous Monday to Sunday.
  • Asset report: the --email address (prompted when run interactively, with a confirmation).

MonthlyWorkspaceReportExport ​

WithMultipleSheets. Takes one array (assets_data, folder_data, collage_data, share_data, user_data, date_data, workspace_name); a missing key becomes an empty sheet. All sheets except Share use the WithBoldHeaderRow trait (bold row 1, left aligned); Share does the same in its own registerEvents().

Sheet classTitleColumns
MonthlyWorkspaceReportAssetsSheetAssets DataAsset ID, Name, Viewed, Downloaded, Shared, Other Event
MonthlyWorkspaceReportFolderSheetFolder DataCategory ID, Folder Name, Viewed, Downloaded, Shared, Other Event
MonthlyWorkspaceReportCollageSheetCollage DataCollection ID, Collage Name, Viewed, Downloaded, Shared, Other Event
MonthlyWorkspaceReportShareSheetShare DataShare ID, Share URL, View Count, Downloaded Count, Asset IDs
MonthlyWorkspaceReportUserSheetUser DataUser ID, User Name, Type, Event Breakdown, IDs
MonthlyWorkspaceReportDateSheetDate DataActivity Date, User Name, Environment, Event, Total Events, Asset IDs, Collection IDs, Category IDs, Share IDs

Share URL is built as {share_origin or DAM_FRONTEND_URL}/[{workspace-name-slug}/]shared-assets/{base64 share_id}?status={base64 'collection' or 'multiple'}; the workspace segment is added only when generated_source is admin. Column B gets an "Open link" hyperlink. User Data "Event Breakdown" is {event_key}({event_count}), and "IDs" picks asset, collection or category ids from the event key prefix.

WeeklyPlatformReportExport ​

WithMultipleSheets, constructed with two collections from transaction_activities.

Sheet classTitleColumns
WeeklyPlatformReportSheet1Activity DetailsDate, Workspace ID, Workspace Name, Environment, User ID, User Name, Event Breakdown, Total Events
WeeklyPlatformReportSheet2User SummaryDate, Workspace ID, Workspace Name, Admin Users Count, Admin User Names, Dealer Users Count, Dealer User Names, External Users Count, External User Names

WorkspaceAssetReportExport ​

FromArray, WithHeadings, WithTitle (Asset Report), WithEvents. Columns:

asset_id, display_file_name, file_type, file_size, width, height, category_id, category_path, tags, custom_field_values, instance_visibility, collection_ids, asset_url, compress_file_url, modified_at, created_at, created_by_id, description.

asset_url and compress_file_url are S3 pre-signed URLs valid for 7 days (temporaryUrl, the SigV4 maximum) and are rendered as underlined hyperlinks. Row data is read with raw SQL from digital_assets, digital_assets_tags, dam_collection_assets, dam_instance_permissions and a recursive digital_assets_categories path query.

InquiriesExport ​

FromCollection, WithHeadings, WithColumnFormatting (column E, Phone, formatted as 0). Columns: Created Date, User Name, Email, Company Name, Phone, Payment Status, Requested Plan, Inquiry Status. The controller picks the date range from type (week, month, quarter, year, semi-month) or start_date / end_date.

Exports not referenced ​

Each takes an array $excelData and returns it as the collection (FromCollection, WithHeadings, Exportable). No caller exists in app/ or routes/.

ClassColumns
DamAseestOrderExportId, Name, Email, Total Items, Total Amount, Order Date, Status
DamImagesExportName, Url
DealershipExportSr. no, Name, Primary contact, Primary contact role, Email, Phone, City, Country, Assign leads, Last activity, Category, RSM, Products
LeadAnalyticsReportExportName, Email, Created Date, Dealership Name, Product Name, Status Name
LeadExportSr. no, Name, Email, Phone, Address, Form title, Lead source, Lead score, Lead date, Last activity, Product name, Category, Dealership name, RSM name, Variation name, Variation value
RsmLeadExportId, Name, Email, Phone, Product Name, Category, Dealership, RSM, Variation Name, Variation Value, Lead Source, Lead Score, Created Date, Updated Date, Status
RsmUserListID, RSM Name, RSM Email, RSM Phone, Assigned Leads, Associated Dealerships, Associated Products

Imports ​

All six classes use ToCollection and WithHeadingRow (so row keys are the snake-cased heading names). None is referenced from app/ or routes/; they belong to the LM module.

ClassTargetExpected columns / mappingNotes
DealershipImportLM\Dealershipemail, dealership_name, address, phone, country, state, city, zipConstructor ($workspaceId, $user, $userId); generates dealership_number
DealershipImportWithMappingLM\Dealershipemail plus a user mapping list of {databaseColumn, sheetColumn}Chunk and batch size 150. Skips existing emails in the workspace. zip_code goes through ZipCode::sanitize2 and findAddressFromZipRadar and fills lat, lon, open_street_map_address, city, state, country, address_line_1
LeadImportLM\Leademail, first_name, last_name, phone_number, street, city, country, state, zipcode, lead_score, form_name, sharpspring_id, is_qualified, lead_create_date, lead_last_activity_dateSkips existing leads; sets lead_source Web, is_import 1. Product, dealership and distance logic is commented out
LeadImportOldLM\LeadSame as LeadImport without lead_scoreOlder copy; updates created_at, updated_at, is_qualify on existing leads
LeadImportWithMappingLM\Leademail plus a mapping listChunk and batch size 150. Converts created_at from America/Denver to UTC when the sheet has SharpSpring ids; geocodes zip_code with Radar; calls createImportLeadEvent() after each insert; calls gravatar() for the email
ProductImportWithMappingLM\Product and LM\ProductAliasproduct_name, category_id plus a mapping listChunk and batch size 150. Validates the category, skips existing products, splits product_aliases on commas and inserts new ProductAlias rows; drops product_image