/**
  * Handle the invite group member command.
  *
  * @param \Gitamin\Commands\User\InviteGroupMemberCommand $command
  */
 public function handle(InviteGroupMemberCommand $command)
 {
     foreach ($command->emails as $email) {
         $invite = Invite::create(['email' => $email]);
         event(new UserWasInvitedEvent($invite));
     }
 }
Esempio n. 2
0
 /**
  * Handle the signup with invite.
  *
  * @param string|null $code
  *
  * @return \Illuminate\View\View
  */
 public function getSignup($code = null)
 {
     if ($code === null) {
         //throw new NotFoundHttpException();
     }
     $invite = Invite::where('code', '=', $code)->first();
     if (!$invite || $invite->claimed()) {
         //throw new BadRequestHttpException();
     }
     return View::make('signup')->withCode($invite ? $invite->code : '')->withUsername(Binput::old('username'))->withEmail(Binput::old('emai', $invite ? $invite->email : ''));
 }
Esempio n. 3
0
 /**
  * Handle the unsubscribe.
  *
  * @param string|null $code
  *
  * @return \Illuminate\View\View
  */
 public function postSignup($code = null)
 {
     if ($code === null) {
         throw new NotFoundHttpException();
     }
     $invite = Invite::where('code', '=', $code)->first();
     if (!$invite || $invite->claimed()) {
         throw new BadRequestHttpException();
     }
     try {
         $this->dispatch(new SignupUserCommand(Binput::get('username'), Binput::get('password'), Binput::get('email'), 2));
     } catch (ValidationException $e) {
         return Redirect::route('signup.invite', ['code' => $invite->code])->withInput(Binput::except('password'))->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('gitamin.signup.failure')))->withErrors($e->getMessageBag());
     }
     $this->dispatch(new ClaimInviteCommand($invite));
     return Redirect::route('explore')->withSuccess(sprintf('<strong>%s</strong> %s', trans('dashboard.notifications.awesome'), trans('gitamin.signup.success')));
 }