data = $data; } public function collection() { return $this->data; } public function registerEvents(): array { return [ // Handle by a closure. BeforeExport::class => [self::class, "beforeExport"] ]; } public static function beforeExport(BeforeExport $event) { // } }