<?php
namespace Maatwebsite\Excel;
use Maatwebsite\Excel\Events\AfterSheet;
use Maatwebsite\Excel\Events\BeforeExport;
use Maatwebsite\Excel\Events\BeforeSheet;
use Maatwebsite\Excel\Events\BeforeWriting;
use Maatwebsite\Excel\Events\Event;
trait RegistersCustomConcerns
{
/**
* @var array
*/
private static $eventMap = [
BeforeWriting::class => Writer::class,
BeforeExport::class => Writer::class,
BeforeSheet::class => Sheet::class,
AfterSheet::class => Sheet::class,
];
/**
* @param string $concern
* @param callable $handler
* @param string $event
*/
public static function extend(string $concern, callable $handler, string $event = BeforeWriting::class)
{
/** @var HasEventBus $delegate */
$delegate = static::$eventMap[$event] ?? BeforeWriting::class;
$delegate::listen($event, function (Event $event) use ($concern, $handler) {
if ($event->appliesToConcern($concern)) {
$handler($event->getConcernable(), $event->getDelegate());
}
});
}
}
Save Cards
Simplify your payment experience by securely saving your card on our platform. After your initial transaction, you can choose to store your card details safely for future use. This feature eliminates the need to re-enter your payment information each time, making checkouts faster while keeping your data secure with advanced encryption and robust security measures.