(string) $this->encodePrimaryKey($bank_transaction->id), 'transaction_id' => (int)$bank_transaction->transaction_id, 'amount' => (float)$bank_transaction->amount ?: 0, 'currency_code' => (string)$bank_transaction->currency_code ?: '', 'account_type' => (string)$bank_transaction->account_type ?: '', 'category_id' => (int) $bank_transaction->category_id, 'category_type' => (string)$bank_transaction->category_type ?: '', 'date' => (string)$bank_transaction->date ?: '', 'bank_account_id' => (int)$bank_transaction->bank_account_id, 'description' => (string)$bank_transaction->description ?: '', 'invoice_id' => (string)$this->encodePrimaryKey($bank_transaction->invoice_id) ?: '', 'expense_id'=> (string)$this->encodePrimaryKey($bank_transaction->expense_id) ?: '', 'is_matched'=> (bool)$bank_transaction->is_matched ?: '', 'is_deleted' => (bool) $bank_transaction->is_deleted, 'created_at' => (int) $bank_transaction->created_at, 'updated_at' => (int) $bank_transaction->updated_at, 'archived_at' => (int) $bank_transaction->deleted_at, ]; } public function includeAccount(BankTransaction $bank_transaction) { $transformer = new AccountTransformer($this->serializer); return $this->includeItem($bank_transaction->account, $transformer, Account::class); } public function includeCompany(BankTransaction $bank_transaction) { $transformer = new CompanyTransformer($this->serializer); return $this->includeItem($bank_transaction->company, $transformer, Company::class); } public function includeInvoice(BankTransaction $bank_transaction) { $transformer = new InvoiceTransformer($this->serializer); return $this->includeItem($bank_transaction->invoice, $transformer, Invoice::class); } public function includeExpense(BankTransaction $bank_transaction) { $transformer = new ExpenseTransformer($this->serializer); return $this->includeItem($bank_transaction->expense, $transformer, Expense::class); } }