pluck("game_data_id")->toArray(); $groups = Group::whereIn("id", $registrationIds)->get(); } else { $groups = Group::all(); } header("Access-Control-Allow-Methods: GET"); header("Access-Control-Allow-Headers: X-Requested-With, Content-Type, Accept"); header('Content-Type: application/json;charset=UTF-8'); echo json_encode(array('data' => $groups->jsonSerialize()));