mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
add Exports Invoice Transactions log
This commit is contained in:
@@ -23,6 +23,7 @@ class ExportsInvoiceTransactions implements FromQuery, WithHeadings, WithHeading
|
||||
use Exportable;
|
||||
|
||||
private $request;
|
||||
private $counter = 1;
|
||||
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
@@ -70,6 +71,17 @@ class ExportsInvoiceTransactions implements FromQuery, WithHeadings, WithHeading
|
||||
{
|
||||
$row = null;
|
||||
|
||||
$logArray = [];
|
||||
$logArray['counter'] = $this->counter;
|
||||
$this->counter += 1;
|
||||
$logArray['system'] = $transaction->system;
|
||||
$logArray['StatementTransactionOwner_id'] = $transaction->id;
|
||||
$logArray = json_encode($logArray);
|
||||
|
||||
$filePath = storage_path('logs/exports_invoice_transactions.log');
|
||||
$textToAppend = Carbon::now()->format('[Y-m-d H:i:s]') . ' ' . $logArray . PHP_EOL;
|
||||
file_put_contents($filePath, $textToAppend, FILE_APPEND);
|
||||
|
||||
if($transaction->system == 'EXCHANGE') {
|
||||
$row = (App()->make($transaction->owner_type))->where('id', $transaction->owner_id)->first();
|
||||
$company = $row->type === TransactionType::PAYMENT ? $row->owner->company : $row->owner->owner;
|
||||
|
||||
Reference in New Issue
Block a user