This commit is contained in:
Julian Prieber 2023-08-24 14:10:21 +02:00
parent a4959c0401
commit bedb1cadb1
1 changed files with 2 additions and 2 deletions

View File

@ -99,8 +99,8 @@ public function users(Request $request)
// Rest of your code to calculate click counts and link counts for each user // Rest of your code to calculate click counts and link counts for each user
foreach ($users as $user) { foreach ($users as $user) {
$user->clicks = $clicksCounts[$user->id]->total_clicks ?? 0; $user->clicks = Link::where('user_id', $user->id)->sum('click_number');
$user->links = $linksCounts[$user->id]->total_links ?? 0; $user->links = Link::where('user_id', $user->id)->select('link')->count();
} }
$data['users'] = $users; $data['users'] = $users;