From bd112860ff9c7649e5d9b228563b91ff1d6a388c Mon Sep 17 00:00:00 2001 From: manel Date: Sun, 12 Nov 2023 01:00:36 +0100 Subject: [PATCH] Refactor --- app/Livewire/Tokens.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/Livewire/Tokens.php b/app/Livewire/Tokens.php index 7a99c16..9571110 100644 --- a/app/Livewire/Tokens.php +++ b/app/Livewire/Tokens.php @@ -27,12 +27,10 @@ public function reloadTokens() { $result = Http::get(config('tokens.api_url'))->object(); - $tokens = collect($result->balances); - $this->tokens->shift(); $this->tokens->prepend( - $tokens->sortBy(fn ($token) => $token->price * $token->balance) + $tokens = collect($result->balances)->sortBy(fn ($token) => $token->price * $token->balance) ); $this->balances['prices'][] = $result->ethereumPrice->usd;