50 lines
1.0 KiB
PHP
50 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Exports;
|
|
|
|
use App\Models\admin\ManagePassport;
|
|
use Maatwebsite\Excel\Concerns\FromCollection;
|
|
use Maatwebsite\Excel\Concerns\WithHeadings;
|
|
|
|
|
|
class PassportExport implements FromCollection , WithHeadings
|
|
{
|
|
/**
|
|
* @return \Illuminate\Support\Collection
|
|
*/
|
|
public function collection()
|
|
{
|
|
return ManagePassport::select(
|
|
'id',
|
|
'passport_name',
|
|
'description',
|
|
'activated_on',
|
|
'expiry_on',
|
|
'is_popular',
|
|
'capacity',
|
|
'coupon_code',
|
|
'price',
|
|
'is_active',
|
|
'is_expired',
|
|
)->get();
|
|
}
|
|
|
|
//function header in excel
|
|
public function headings(): array
|
|
{
|
|
return [
|
|
'Id',
|
|
'Passport name',
|
|
'Description',
|
|
'Activated date',
|
|
'Expiry date',
|
|
'is_popular',
|
|
'Capacity',
|
|
'Coupon code',
|
|
'Price',
|
|
'is_active',
|
|
'is_expired',
|
|
];
|
|
}
|
|
}
|