This commit is contained in:
hackerESQ
2024-09-05 18:36:45 -05:00
parent cf89c44a62
commit 6f6f957dd7
+2 -4
View File
@@ -160,7 +160,7 @@ class Transaction extends Model
} }
// get the holding for a symbol and portfolio (or create one) // get the holding for a symbol and portfolio (or create one)
$holding = Holding::firstOrCreate([ Holding::firstOrNew([
'portfolio_id' => $this->portfolio_id, 'portfolio_id' => $this->portfolio_id,
'symbol' => $this->symbol 'symbol' => $this->symbol
], [ ], [
@@ -169,8 +169,6 @@ class Transaction extends Model
'quantity' => $this->quantity, 'quantity' => $this->quantity,
'average_cost_basis' => $this->cost_basis, 'average_cost_basis' => $this->cost_basis,
'total_cost_basis' => $this->quantity * $this->cost_basis, 'total_cost_basis' => $this->quantity * $this->cost_basis,
]); ])->syncTransactionsAndDividends();
$holding->syncTransactionsAndDividends();
} }
} }