mirror of
https://gitlab.com/uldvstar/exchange-2.0.git
synced 2026-08-19 04:24:16 +00:00
add marking in ExportsTransactions
This commit is contained in:
@@ -11,8 +11,9 @@ use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\FromQuery;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadingRow;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
|
||||
class ExportsTransactions implements FromQuery, WithHeadingRow, WithMapping
|
||||
class ExportsTransactions implements FromQuery, WithHeadingRow, WithMapping, ShouldAutoSize
|
||||
{
|
||||
|
||||
use Exportable;
|
||||
@@ -58,6 +59,20 @@ class ExportsTransactions implements FromQuery, WithHeadingRow, WithMapping
|
||||
6 => 'EXPIRED'
|
||||
];
|
||||
|
||||
switch ($transaction->owner_type) {
|
||||
case "App\Models\Booking":
|
||||
$marking = $transaction->booking->company->reference;
|
||||
break;
|
||||
case "App\Models\Transaction":
|
||||
$marking = $transaction->transactions()->first()->booking->company->reference;
|
||||
break;
|
||||
case "App\Models\Wallet":
|
||||
$marking = $transaction->owner->owner->reference;
|
||||
break;
|
||||
default:
|
||||
$marking = '';
|
||||
}
|
||||
|
||||
return [
|
||||
$transaction->bill_no,
|
||||
$transaction->owner_id,
|
||||
@@ -75,6 +90,7 @@ class ExportsTransactions implements FromQuery, WithHeadingRow, WithMapping
|
||||
$transactionStatus[$transaction->status],
|
||||
\PhpOffice\PhpSpreadsheet\Shared\Date::dateTimeToExcel($transaction->created_at),
|
||||
\PhpOffice\PhpSpreadsheet\Shared\Date::dateTimeToExcel($transaction->updated_at),
|
||||
$marking
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user