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

This commit is contained in:
omair saleh
2021-07-02 18:28:56 +08:00
parent f4752003ab
commit 2b5ceeee94
@@ -43,6 +43,9 @@ class ExportsCustomers implements FromQuery, WithHeadingRow, WithMapping
*/
public function map($company): array
{
dd(count($company->whereHas('segments', function($query){
return $query->where('id', '=', 5);
})->get()) ? 'Exchange 1.0' : 'Exchange 2.0');
return [
$company->reference,
$company->name,
@@ -51,7 +54,7 @@ class ExportsCustomers implements FromQuery, WithHeadingRow, WithMapping
$company->bookings()->sum('fix_amount'),
\PhpOffice\PhpSpreadsheet\Shared\Date::dateTimeToExcel($company->created_at),
count($company->whereHas('segments', function($query){
$query->where('id', '=', 5);
return $query->where('id', '=', 5);
})->get()) ? 'Exchange 1.0' : 'Exchange 2.0'
];
}