transaction_id = $this->transaction?->id; $this->journal_id = $this->journal?->id; $this->account_id = $this->account->id; $this->client_id = $this->transaction?->branch->client_id ?? $this->journal?->client_id; $accountType = $this->type ? strtolower($this->type) : strtolower($this->transaction?->account_type); $this->credit_amount = $accountType == 'credit' ? $this->amount : 0.00; $this->debit_amount = $accountType == 'debit' ? $this->amount : 0.00; $this->description = $this->transaction?->description ?? $this->journal?->description; $this->data = Arr::except($this->toArray(), ['transaction', 'journal', 'ledger', 'account', 'amount', 'type']); } }