add column for old or new customers in the customer excel export

This commit is contained in:
omair saleh
2021-07-02 17:56:45 +08:00
parent 0a23702c29
commit eb432a4347
@@ -24,6 +24,7 @@ class ExportsCustomers implements FromQuery, WithHeadingRow, WithMapping
'Number of bookings',
'Bookings total',
'Registration Date',
'System Registration'
];
}
@@ -48,7 +49,10 @@ class ExportsCustomers implements FromQuery, WithHeadingRow, WithMapping
$company->type === CompanyType::COMPANY_BUSINESS ? 'Company' : 'individual',
count($company->bookings),
$company->bookings()->sum('fix_amount'),
\PhpOffice\PhpSpreadsheet\Shared\Date::dateTimeToExcel($company->created_at)
\PhpOffice\PhpSpreadsheet\Shared\Date::dateTimeToExcel($company->created_at),
count($company->whereHas('segments', function($query){
$query->where('id', '=', 5);
})->get()) ? 'Exchange 1.0' : 'Exchange 2.0'
];
}
}