/** * Registers a given player. * * @param Request $request * * @return Response */ public function registerPlayer(Request $request) { $data = $request->all(); $user = $this->usersRepository->addUser($data['email'], $data['name'], $data['password']); $player = $this->playersRepository->addPlayer($user, $user->name); return ['player' => $player->toArray()]; }
/** * Registers a new admin into the system. * * @param Request $request * * @return Response */ public function registerAdministrator(Request $request) { $data = $request->all(); // TODO: Validate the data. $user = $this->usersRepository->addUser($data['email'], $data['name'], $data['password']); $admin = $this->administratorsRepository->addAdministrator($user, $user->name); return ['administrator' => $admin->toArray()]; }