Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $groups = Groups::all();
- $arr = [];
- foreach ($groups as $group) {
- $item = $group->toArray();
- $item['active_bets'] = $group->bets()->active()->count(); // går ud fra du har lavet et eloquent scope der hedder active
- $arr[] = $item;
- }
- return response()->json($arr);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement