<?php
 namespace App\Observers; use App\Core\Hook\HookBridge; use App\Models\Transaction; class TransactionObserver { public function created(Transaction $txn): void { app(HookBridge::class)->fireAction('AddTransaction', [ 'id' => $txn->id, 'transaction' => $txn, 'userid' => $txn->client_id, 'currency' => $txn->currency_id, 'gateway' => $txn->payment_gateway, 'date' => optional($txn->created_at)->toDateTimeString(), 'description' => $txn->description, 'amountin' => (float) ($txn->amount_in ?? $txn->amount ?? 0), 'fees' => (float) ($txn->bank_fee ?? 0), 'amountout' => (float) ($txn->amount_out ?? 0), 'rate' => 1.0, 'transid' => $txn->transaction_id, 'invoiceid' => $txn->invoice_id, 'refundid' => null, ]); } } 