Start working on the invite system for users

This commit is contained in:
Joseph Cohen
2015-10-31 15:33:11 -06:00
parent 6d52f49461
commit f6318409a7
13 changed files with 373 additions and 3 deletions

View File

@@ -62,6 +62,17 @@ class TeamController extends Controller
->withPageTitle(trans('dashboard.team.add.title').' - '.trans('dashboard.dashboard'));
}
/**
* Shows the invite team member view.
*
* @return \Illuminate\View\View
*/
public function showInviteTeamMemberView()
{
return View::make('dashboard.team.invite')
->withPageTitle(trans('dashboard.team.invite.title').' - '.trans('dashboard.dashboard'));
}
/**
* Creates a new team member.
*
@@ -111,6 +122,28 @@ class TeamController extends Controller
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.team.edit.success')));
}
/**
* Creates a new team member.
*
* @return \Illuminate\Http\RedirectResponse
*/
public function postInviteUser()
{
try {
$this->dispatch(new InviteTeamMemberCommand(
array_unique(array_filter((array) Binput::get('emails')))
));
} catch (ValidationException $e) {
return Redirect::route('dashboard.team.invite')
->withInput(Binput::except('password'))
->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.team.invite.failure')))
->withErrors($e->getMessageBag());
}
return Redirect::route('dashboard.team.invite')
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.team.invite.success')));
}
/**
* Delete a user.
*