public function profile(TransactionRepository $transactions, VolunteerRepository $volunteers) { $user = \Auth::user(); $tier = $transactions->getUserTier($user); $volunteer_status = $volunteers->getStatus($user); return view('user_profile', ['user' => $user, 'tier' => $tier, 'volunteer' => $volunteer_status]); }
public function join(VolunteerRepository $volunteers) { $user = \Auth::user(); if ($volunteers->awaitingJoin($user)) { $alert = new AlertMsg('alert-info', _("You were already on the queue for joining. You will find an invite from GitHub in your inbox.")); } else { $volunteers->join($user); $alert = new AlertMsg('alert-info', _("Now you are already on the queue for joining. You will find an invite from GitHub in your inbox.")); } \Session::flash('heading_msgs', array_merge(\Session::get('heading_msgs', []), [$alert])); return redirect(action('UserController@profile')); }
public function orgPost(Request $request, VolunteerRepository $volunteers) { $username = $request->input('username'); $team = $request->input('team'); $client = new Client(); $token = Session::get('github.user')->token; $req = $client->put(sprintf('https://api.github.com/teams/%s/memberships/%s', $this->getTeamId($team), $username), ['Authorization' => 'token ' . $token, 'Accept' => 'application/vnd.github.ironman-preview+json', 'User-Agent' => 'Mozilla/1.0 (@gpul-labs registrar)'], Json::encode(['role' => 'member'])); try { $response = $req->send(); $r = $response->json(); } catch (ClientErrorResponseException $e) { dd($e); throw $e; } $volunteers->setAccepted($username); Session::push('debug.response', $r); add_heading_msg('alert-info', sprintf(_("Invited %1s successfully (current state: %2s)"), $username, $r['state'])); if ($team == 'voluntarios') { return redirect(action('Admin\\AdminController@volunteerRequests')); } return redirect(action('Admin\\AdminController@orgRequests')); }