fix delete transaction flow
This commit is contained in:
@@ -55,7 +55,7 @@ class Holding extends Model
|
||||
*/
|
||||
public function transactions()
|
||||
{
|
||||
return $this->hasManyThrough(Transaction::class, Portfolio::class, 'id', 'portfolio_id', 'portfolio_id', 'id');
|
||||
return $this->hasManyThrough(Transaction::class, Portfolio::class, 'id', 'portfolio_id', 'portfolio_id', 'id')->orderBy('date', 'DESC');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -57,7 +57,7 @@ class MarketData extends Model
|
||||
|
||||
// check if new or stale
|
||||
if (
|
||||
!$market_data->exists
|
||||
!$market_data->exists
|
||||
|| is_null($market_data->updated_at)
|
||||
|| $market_data->updated_at->diffInMinutes(now()) >= config('market_data.refresh')
|
||||
) {
|
||||
@@ -67,10 +67,10 @@ class MarketData extends Model
|
||||
|
||||
// fill data
|
||||
$market_data->fill($quote->toArray());
|
||||
}
|
||||
|
||||
// save with timestamps updated
|
||||
$market_data->touch();
|
||||
// save with timestamps updated
|
||||
$market_data->touch();
|
||||
}
|
||||
|
||||
return $market_data;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user