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

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