Created
December 7, 2016 17:52
-
-
Save alysdal/eaf4e8115d7375d5411c45872c38dcb9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment