wip
This commit is contained in:
@@ -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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user