Created
December 27, 2018 13:40
-
-
Save ssx/59ece214623f6eccec04f016920b481d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Nova\Actions; | |
use App\Models\Order; | |
use Maatwebsite\Excel\Concerns\WithHeadings; | |
use Maatwebsite\Excel\Concerns\WithMapping; | |
use Maatwebsite\LaravelNovaExcel\Actions\DownloadExcel; | |
use PhpOffice\PhpSpreadsheet\Shared\Date; | |
class ExportOrders extends DownloadExcel implements WithMapping, WithHeadings | |
{ | |
/** | |
* @return array | |
*/ | |
public function headings(): array | |
{ | |
return [ | |
'internal_order_id', | |
'created_at', | |
'stripe_transaction_id', | |
'buyer_name', | |
'buyer_email', | |
'billing_address', | |
'delivery_name', | |
'delivery_address', | |
'giftcard_amount', | |
'total_paid', | |
'message', | |
'status' | |
]; | |
} | |
/** | |
* @param Order $order | |
* | |
* @return array | |
*/ | |
public function map($order): array | |
{ | |
return [ | |
$order->id, | |
$order->created_at, | |
$order->transaction_id, | |
$order->buyer_name, | |
$order->buyer_email, | |
$order->billing_address, | |
$order->recipient_name, | |
$order->delivery_address, | |
$order->amount, | |
$order->total, | |
$order->notes, | |
$order->status | |
]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment