From 912f63105f9405c6902c99e6c1b7be035ba7362e Mon Sep 17 00:00:00 2001 From: raccoon254 Date: Sat, 15 Jun 2024 15:06:22 +0300 Subject: [PATCH] Fetch only three last orders --- app/Livewire/Dashboard.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Livewire/Dashboard.php b/app/Livewire/Dashboard.php index e85eeaa..676b310 100644 --- a/app/Livewire/Dashboard.php +++ b/app/Livewire/Dashboard.php @@ -10,7 +10,9 @@ class Dashboard extends Component public $orders; public function mount(): void { - $this->orders = auth()->user()->orders; + // Get the authenticated user and fetch their latest 3 orders + $user = auth()->user(); + $this->orders = $user->orders()->latest()->take(3)->get(); } public function render(): View