* @author Graham Campbell * @author James Brooks */ class UnsubscribeSubscriberCommandHandler { /** * Handle the subscribe customer command. * * @param \CachetHQ\Cachet\Bus\Commands\Subscriber\UnsubscribeSubscriberCommand $command * * @return void */ public function handle(UnsubscribeSubscriberCommand $command) { $subscriber = $command->subscriber; // First remove subscriptions. $subscriber->subscriptions()->delete(); event(new SubscriberHasUnsubscribedEvent($subscriber)); // Then remove the subscriber. $subscriber->delete(); } }