From b97a41f7ad21ac188e62d327b53c843f21aee1cb Mon Sep 17 00:00:00 2001 From: hackerESQ Date: Sun, 3 Nov 2024 08:41:14 -0600 Subject: [PATCH] fix:scope chat history for each user --- app/Models/Holding.php | 2 +- app/Models/Portfolio.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Models/Holding.php b/app/Models/Holding.php index bd35f9a..b8c7d87 100644 --- a/app/Models/Holding.php +++ b/app/Models/Holding.php @@ -139,7 +139,7 @@ class Holding extends Model */ public function chats() { - return $this->morphMany(AiChat::class, 'chatable'); + return $this->morphMany(AiChat::class, 'chatable')->where('user_id', auth()->user()->id); } public function scopeWithMarketData($query) diff --git a/app/Models/Portfolio.php b/app/Models/Portfolio.php index 6e7f167..0660745 100644 --- a/app/Models/Portfolio.php +++ b/app/Models/Portfolio.php @@ -72,7 +72,7 @@ class Portfolio extends Model */ public function chats() { - return $this->morphMany(AiChat::class, 'chatable'); + return $this->morphMany(AiChat::class, 'chatable')->where('user_id', auth()->user()->id); } public function scopeMyPortfolios()