feat:adds user option to sync and refresh commands

This commit is contained in:
hackerESQ
2024-10-23 16:57:55 -05:00
parent ab24b528d1
commit ff725e0119
4 changed files with 25 additions and 11 deletions
+3 -3
View File
@@ -159,10 +159,10 @@ class Holding extends Model
->where('portfolios.wishlist', 0);
}
public function scopeMyHoldings($query)
public function scopeMyHoldings($query, $userId = null)
{
return $query->whereHas('portfolio', function($query) {
$query->whereRelation('users', 'id', auth()->user()->id);
return $query->whereHas('portfolio', function($query) use ($userId) {
$query->whereRelation('users', 'id', $userId ?? auth()->user()->id);
});
}