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

@@ -16,14 +16,11 @@ use CachetHQ\Cachet\Commands\Subscriber\UnsubscribeSubscriberCommand;
use CachetHQ\Cachet\Models\Subscriber;
use GrahamCampbell\Binput\Facades\Binput;
use Illuminate\Database\QueryException;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Support\Facades\Request;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
class SubscriberController extends AbstractApiController
{
use DispatchesJobs;
/**
* Get all subscribers.
*
@@ -44,7 +41,7 @@ class SubscriberController extends AbstractApiController
public function postSubscribers()
{
try {
$subscriber = $this->dispatch(new SubscribeSubscriberCommand(Binput::get('email'), Binput::get('verify', false)));
$subscriber = dispatch(new SubscribeSubscriberCommand(Binput::get('email'), Binput::get('verify', false)));
} catch (QueryException $e) {
throw new BadRequestHttpException();
}
@@ -61,7 +58,7 @@ class SubscriberController extends AbstractApiController
*/
public function deleteSubscriber(Subscriber $subscriber)
{
$this->dispatch(new UnsubscribeSubscriberCommand($subscriber));
dispatch(new UnsubscribeSubscriberCommand($subscriber));
return $this->noContent();
}