Use the new dispatch helper function

This commit is contained in:
Graham Campbell
2015-12-24 15:16:09 +00:00
parent 98795c8220
commit 5557edc342
15 changed files with 41 additions and 86 deletions

View File

@@ -17,15 +17,12 @@ use CachetHQ\Cachet\Commands\User\InviteTeamMemberCommand;
use CachetHQ\Cachet\Commands\User\RemoveUserCommand;
use CachetHQ\Cachet\Models\User;
use GrahamCampbell\Binput\Facades\Binput;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\View;
class TeamController extends Controller
{
use DispatchesJobs;
/**
* Shows the team members view.
*
@@ -84,7 +81,7 @@ class TeamController extends Controller
public function postAddUser()
{
try {
$this->dispatch(new AddTeamMemberCommand(
dispatch(new AddTeamMemberCommand(
Binput::get('username'),
Binput::get('password'),
Binput::get('email'),
@@ -133,7 +130,7 @@ class TeamController extends Controller
public function postInviteUser()
{
try {
$this->dispatch(new InviteTeamMemberCommand(
dispatch(new InviteTeamMemberCommand(
array_unique(array_filter((array) Binput::get('emails')))
));
} catch (ValidationException $e) {
@@ -156,7 +153,7 @@ class TeamController extends Controller
*/
public function deleteUser(User $user)
{
$this->dispatch(new RemoveUserCommand($user));
dispatch(new RemoveUserCommand($user));
return Redirect::route('dashboard.team.index')
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.team.delete.success')));