<?php
namespace Maatwebsite\Excel;
use Illuminate\Support\Collection;
use Maatwebsite\Excel\Concerns\ToArray;
use Maatwebsite\Excel\Concerns\ToCollection;
use Maatwebsite\Excel\Concerns\ToModel;
use Maatwebsite\Excel\Concerns\WithCalculatedFormulas;
use Maatwebsite\Excel\Concerns\WithFormatData;
use Maatwebsite\Excel\Concerns\WithMappedCells;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
class MappedReader
{
/**
* @param WithMappedCells $import
* @param Worksheet $worksheet
*
* @throws \PhpOffice\PhpSpreadsheet\Exception
*/
public function map(WithMappedCells $import, Worksheet $worksheet)
{
$mapped = $import->mapping();
array_walk_recursive($mapped, function (&$coordinate) use ($import, $worksheet) {
$cell = Cell::make($worksheet, $coordinate);
$coordinate = $cell->getValue(
null,
$import instanceof WithCalculatedFormulas,
$import instanceof WithFormatData
);
});
if ($import instanceof ToModel) {
$model = $import->model($mapped);
if ($model) {
$model->saveOrFail();
}
}
if ($import instanceof ToCollection) {
$import->collection(new Collection($mapped));
}
if ($import instanceof ToArray) {
$import->array($mapped);
}
}
}
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.