Handle the create schedule command.

@param \CachetHQ\Cachet\Bus\Commands\Schedule\CreateScheduleCommand $command

@return \CachetHQ\Cachet\Models\Schedule
349509
public function handle(CreateScheduleCommand $command)
    {
        try {
            $schedule = Schedule::create($this->filter($command));

            event(new ScheduleWasCreatedEvent($this->auth->user(), $schedule));
        } catch (InvalidArgumentException $e) {
            throw new ValidationException(new MessageBag([$e->getMessage()]));
        }

        return $schedule;
    }
836621
protected function registerMakeControllerCommand($command)
    {
        $this->app->singleton($command, function ($app) {
            return new Generators\Commands\ControllerMakeCommand($app);
        });
    }
1330302
public function handle(AbstractCommand $command)
    {
        $this->commandDispatcher->handle($command);
        // Now that the command is handled, let's found if there is some events to publish
        $events = $this->extractEventsFromCommand($command);
        foreach ($events as $event) {
            // we will only publish event to synchronous listeners
            $this->publish($event);
        }

        return $command;
    }
1156799
public function handle($command)
    {
        $user = new User();
        $user
            ->setEmail($command->getEmail())
            ->setPassword($command->getPassword())
            ->setRoles($this->registeredUserRoles)
            ->setEnabled(true);

        // validate user
        $errors = $this->validator->validate($user);
        if (count($errors) > 0) {
            $exception = new InvalidCommandException("User is invalid");
            $exception->setConstraintViolationList($errors);
            throw $exception;
        }

        // persist user
        $this->entityManager->persist($user);
        $this->entityManager->flush();

        return $user;
    }
776095
public function runCommand(Command $command, InputInterface $input, OutputInterface $output) {
    return $this->doRunCommand($command, $input, $output);
  }
381798
public function execute($command)
    {
        $this->executeDecorators($command);

        $handler = $this->commandTranslator->toCommandHandler($command);

        return $this->app->make($handler)->handle($command);
    }
469485
public function fire(Command $command)
    {
        $gitignorePath = base_path('.gitignore');

        if (! $this->gitignoreContainsComposerLock($gitignorePath)) {
            return;
        }

        $removeComposerLock = $command->confirm('Do you want to remove composer.lock from .gitignore ?', true);
        if ($removeComposerLock) {
            $out = $this->getGitignoreLinesButComposerLock($gitignorePath);
            $this->writeNewGitignore($gitignorePath, $out);
        }
    }
917981
public function handle(SingleCommand $command)
    {
        /** @var MigrationRunner $runner */
        $runner = $this->getRunner();
        $runner = $runner->withContext($command->getContext());
        $event = $runner->run(
            $command->getTarget(),
            $command->getOptions()
        );
        return $command->getVersionRepository()->update($event->getTarget());
    }
240861
public function getCommandHandler($command)
    {
        $key = get_class($command);

        if (array_key_exists($key, $this->handlers)) {
            $handler = $this->handlers[$key];

            return $this->container->make($handler);
        }
    }
549788
public function execute($command, callable $next)
    {
        $bus = $this->getBusForCommand($command);
        if ($bus === null) {
            return $next($command);
        }

        return $next($bus->handle($command));
    }
972788
private static function _dispatch($command)
	{
		$dispatcher = self::_getDispatcher();
		$commandEvent = new CommandEvent(PluginEvents::COMMAND, $command, self::_getIO(), self::_getIO());
		$dispatcher->dispatch($commandEvent->getName(), $commandEvent);
	}
1121204
public function update(Schedule $schedule)
    {
        try {
            $schedule = execute(new UpdateScheduleCommand(
                $schedule,
                Binput::get('name'),
                Binput::get('message'),
                Binput::get('status'),
                Binput::get('scheduled_at'),
                Binput::get('completed_at'),
                Binput::get('components', [])
            ));
        } catch (QueryException $e) {
            throw new BadRequestHttpException();
        }

        return $this->item($schedule);
    }
445429
public function handle(CreateComponentCommand $command)
    {
        $component = Component::create($this->filter($command));

        event(new ComponentWasCreatedEvent($this->auth->user(), $component));

        return $component;
    }
555020
public function handle(CreatePage $command)
    {
        $actor = $command->actor;
        $data = $command->data;

        $this->assertAdmin($actor);

        $page = Page::build(
            array_get($data, 'attributes.title'),
            array_get($data, 'attributes.slug'),
            array_get($data, 'attributes.content'),
            array_get($data, 'attributes.isHidden'),
            array_get($data, 'attributes.isHtml')
        );

        $this->validator->assertValid($page->getAttributes());

        $page->save();

        return $page;
    }
1316906
protected function defineCommandSchedule(Schedule $schedule, array $definition)
    {
        $arguments = $definition['arguments'] ?? [];

        $event = $schedule->command($definition['command'], $arguments);

        $this->configureEvent($event, $definition);
    }
1055800
public function runAsProcessReturningProcessObject(string $command) : Process
    {
        $process = new Process($command);
        $process->run();
        $process->setTimeout(null);
        $process->setIdleTimeout(60);
        $process->wait();

        return $process;
    }
840018
protected function _schedule($command, $path, array $arguments, array $options) {
		$TaskClient = ClassRegistry::init('Task.TaskClient');
		$task = $TaskClient->add($command, $path, $arguments, $options);
		if ($task) {
			$waitFor = empty($options['dependsOn']) ? 'none' : implode(', ', $options['dependsOn']) . ' task(s)';
			$this->out("Task #{$TaskClient->id} successfuly added, wait for $waitFor");
		} else {
			$this->err('Error! Task not added!');
		}
		return $task;
	}