public function index() { // $drills = Drill::all(); $ret = []; $i = 1; $r = 0; foreach ($drills as $drill) { $i++; $ret[$r][] = $drill; if ($i == 5) { $i = 1; $r++; } } return response()->json($ret, 200); }
public function clearAll() { $users = User::all(); foreach ($users as $u) { $u->delete(); } $drills = Drill::all(); foreach ($drills as $d) { $d->delete(); } $games = Game::all(); foreach ($games as $g) { $g->delete(); } $clubs = Club::all(); foreach ($clubs as $c) { $c->delete(); } }