Execute the job.

@return Block
348870
public function handle()
    {
        $block = $this->dbTransaction(function () {
            $this->block->fill($this->attributes);
            $this->block->save();

            event('block.updated', [$this->block]);
            return $this->block;
        });
        return $block;
    }
234295
public function handle()
    {
        try {
            if ($name = $this->argument('module')) {
                $name = Str::studly($name);
                $this->moduleSeed($this->getModuleByName($name));
            } else {
                $modules = $this->getModuleRepository()->getOrdered();
                array_walk($modules, [$this, 'moduleSeed']);
                $this->info('All modules seeded.');
            }
        } catch (\Throwable $e) {
            $this->reportException($e);

            $this->renderException($this->getOutput(), $e);

            return 1;
        }
    }
1085448
public function handle()
	{
		$counter = JobsFacade::run();

		if ($counter === false) {
			$this->error('Job executor needs to cool down for '.(JobsFacade::remainingCoolDown() * 60)
                .' seconds! No jobs executed.');
		} else {
			$this->info('Done. Jobs executed: '.$counter.'/'.JobsFacade::count());
		}			
	}
173061
public function handle()
    {
        $daemon = $this->option('daemon');

        if ($this->downForMaintenance() && ! $daemon) {
            return;
        }

        // We'll listen to the processed and failed events so we can write information
        // to the console as jobs are processed, which will let the developer watch
        // which jobs are coming through a queue and be informed on its progress.

        $this->listenForEvents();

        // Get the Config Repository instance.
        $config = $this->container['config'];

        $connection = $this->argument('connection') ?: $config->get('queue.default');

        $delay = $this->option('delay');

        // The memory limit is the amount of memory we will allow the script to occupy
        // before killing it and letting a process manager restart it for us, which
        // is to protect us against any memory leaks that will be in the scripts.

        $memory = $this->option('memory');

        // We need to get the right queue for the connection which is set in the queue
        // configuration file for the application. We will pull it based on the set
        // connection being run for the queue operation currently being executed.

        $queue = $this->option('queue') ?: $config->get(
            "queue.connections.{$connection}.queue", 'default'
        );

        $this->runWorker($connection, $queue, $delay, $memory, $daemon);
    }
1304382
public function execute()
    {
        $pipeline = array_reduce(
            array_reverse($this->pipes), $this->carry(), function ($passable) {
            return $passable;
        }
        );

        return $pipeline($this->passable);
    }
674
protected function job(): void
    {
        CorporationDivision::where('corporation_id', $this->getCorporationId())->get()
            ->each(function ($division) {

                // retrieve last known entry for the current division and active corporation
                $last_known_entry = CorporationWalletJournal::where('corporation_id', $this->getCorporationId())
                                                            ->where('division', $division->division)
                                                            ->orderBy('date', 'desc')
                                                            ->first();

                $this->last_known_entry_id = is_null($last_known_entry) ? 0 : $last_known_entry->id;

                // Perform a journal walk backwards to get all of the
                // entries as far back as possible. When the response from
                // ESI is empty, we can assume we have everything.
                while (true) {

                    $journal = $this->retrieve([
                        'corporation_id' => $this->getCorporationId(),
                        'division'       => $division->division,
                    ]);

                    if ($journal->isCachedLoad()) return;

                    $entries = collect($journal);

                    // If we have no more entries, break the loop.
                    if ($entries->count() === 0)
                        break;

                    $entries->chunk(1000)->each(function ($chunk) use ($division) {

                        // if we've reached the last known entry - abort the process
                        if ($this->at_last_entry)
                            return false;

                        // if we have reached the last known entry, exclude all entries which are lower or equal to the
                        // last known entry and flag the reached status.
                        if ($chunk->where('id', $this->last_known_entry_id)->isNotEmpty()) {
                            $chunk = $chunk->where('id', '>', $this->last_known_entry_id);

                            $this->at_last_entry = true;
                        }

                        $records = $chunk->map(function ($entry, $key) use ($division) {

                            return [
                                'corporation_id'  => $this->getCorporationId(),
                                'division'        => $division->division,
                                'id'              => $entry->id,
                                'date'            => carbon($entry->date),
                                'ref_type'        => $entry->ref_type,
                                'first_party_id'  => $entry->first_party_id ?? null,
                                'second_party_id' => $entry->second_party_id ?? null,
                                'amount'          => $entry->amount ?? null,
                                'balance'         => $entry->balance ?? null,
                                'reason'          => $entry->reason ?? null,
                                'tax_receiver_id' => $entry->tax_receiver_id ?? null,
                                'tax'             => $entry->tax ?? null,
                                // introduced in v4
                                'description'     => $entry->description,
                                'context_id'      => $entry->context_id ?? null,
                                'context_id_type' => $entry->context_id_type ?? null,
                                'created_at'      => carbon(),
                                'updated_at'      => carbon(),
                            ];
                        });

                        CorporationWalletJournal::insertIgnore($records->toArray());
                    });

                    // in case the last known entry has been reached or we non longer have pages, terminate the job.
                    if (! $this->nextPage($journal->pages) || $this->at_last_entry)
                        break;
                }

                // Reset the page for the next wallet division.
                $this->page = 1;

                // Reset the last known entry for the next wallet division.
                $this->last_known_entry_id = 0;

                // Reset the last known entry status for the next wallet division.
                $this->at_last_entry = false;
            });
    }
1189226
public function handle()
    {
        $this->params = $this->getParams();

        $request = substr($this->request->getRequestUri(), strlen($this->request->getBaseUrl()) + 1);

        if (substr($request, 0, 7) == 'themes/') {
            return $this->serveTheme(substr($request, 6));
        }

        if ($request == '') {
            $request = $this->daux->tree->getIndexPage()->getUri();
        }

        return $this->getPage($request);
    }
788946
public function handle()
    {
        $command = $this->option('command');

        ob_start();
        $result = $this->executeCode(
            trim(trim($command), ';').';'
        );
        $output = ob_get_clean();

        if (empty($output) === false) {
            $this->line($output);
            $result = null;
        }

        $this->getOutput()->write('=> ');
        switch (gettype($result)) {
            case 'object':
            case 'array':
                $this->line(var_export($result, true));
                break;
            case 'string':
                $this->comment($result);
                break;
            case 'NULL':
                $this->line('');
                break;
            default:
                is_numeric($result) === true ? $this->info($result) : $this->line($result);
                break;
        }
    }
1180179
public function handle()
    {
        $repository = modules($this->option('location') ?? config('modules.default_location'));

        $slug = $this->argument('slug');

        if ($slug) {
            if (! $repository->exists($slug)) {
                return $this->error('Module does not exist.');
            }

            if ($repository->isEnabled($slug)) {
                $this->seed($slug, $repository);
            }
            elseif ($this->option('force')) {
                $this->seed($slug, $repository);
            }

            return;
        }
        else {
            if ($this->option('force')) {
                $modules = $repository->all();
            }
            else {
                $modules = $repository->enabled();
            }

            foreach ($modules as $module) {
                $this->seed($module['slug'], $repository);
            }
        }
    }
1331850
public function fire()
	{
		$rows = array();

		foreach ($this->laravel['queue.failer']->all() as $failed)
		{
			$rows[] = $this->parseFailedJob((array) $failed);
		}

		if (count($rows) == 0)
		{
			return $this->info('No failed jobs!');
		}

		$table = $this->getHelperSet()->get('table');

		$table->setHeaders(array('ID', 'Connection', 'Queue', 'Class', 'Failed At'))
              ->setRows($rows)
              ->render($this->output);
	}
1253249
public function handle()
	{
		$aimeos = $this->getLaravel()->make( 'aimeos' )->get();
		$context = $this->getContext();

		$process = $context->getProcess();
		$jobs = explode( ' ', $this->argument( 'jobs' ) );
		$localeManager = \Aimeos\MShop::create( $context, 'locale' );

		foreach( $this->getSiteItems( $context, $this->argument( 'site' ) ) as $siteItem )
		{
			$localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false );
			$localeItem->setLanguageId( null );
			$localeItem->setCurrencyId( null );

			$context->setLocale( $localeItem );

			$this->info( sprintf( 'Executing the Aimeos jobs for "%s"', $siteItem->getCode() ) );

			foreach( $jobs as $jobname )
			{
				$fcn = function( $context, $aimeos, $jobname ) {
					\Aimeos\Controller\Jobs::create( $context, $aimeos, $jobname )->run();
				};

				$process->start( $fcn, [$context, $aimeos, $jobname], true );
			}
		}

		$process->wait();
	}
169515
public function executeAllAction()
    {
        $this->_helper->BatchRunner(
                $this->loader->getMailLoader()->getCronBatch('commjob-execute-all'),
                $this->_(''),
                $this->accesslog
                );
    }
1054836
public function execute()
    {
        // Update the build in the database, ping any external services.
        $this->build->setStatus(Build::STATUS_RUNNING);
        $this->build->setStarted(new \DateTime());
        $this->store->save($this->build);
        $this->build->sendStatusPostback();
        $success = true;

        $previous_build = $this->build->getProject()->getPreviousBuild($this->build->getBranch());

        $previous_state = Build::STATUS_NEW;

        if ($previous_build) {
            $previous_state = $previous_build->getStatus();
        }

        try {
            // Set up the build:
            $this->setupBuild();

            // Run the core plugin stages:
            foreach (array('setup', 'test') as $stage) {
                $success &= $this->pluginExecutor->executePlugins($this->config, $stage);
            }

            // Set the status so this can be used by complete, success and failure
            // stages.
            if ($success) {
                $this->build->setStatus(Build::STATUS_SUCCESS);
            } else {
                $this->build->setStatus(Build::STATUS_FAILED);
            }


            if ($success) {
                $this->pluginExecutor->executePlugins($this->config, 'success');

                if ($previous_state == Build::STATUS_FAILED) {
                    $this->pluginExecutor->executePlugins($this->config, 'fixed');
                }

                $this->buildLogger->logSuccess(Lang::get('build_success'));
            } else {
                $this->pluginExecutor->executePlugins($this->config, 'failure');

                if ($previous_state == Build::STATUS_SUCCESS || $previous_state == Build::STATUS_NEW) {
                    $this->pluginExecutor->executePlugins($this->config, 'broken');
                }

                $this->buildLogger->logFailure(Lang::get('build_failed'));
            }
        } catch (\Exception $ex) {
            $this->build->setStatus(Build::STATUS_FAILED);
            $this->buildLogger->logFailure(Lang::get('exception') . $ex->getMessage());
        }finally{
            // Complete stage plugins are always run
            $this->pluginExecutor->executePlugins($this->config, 'complete');
        }


        // Update the build in the database, ping any external services, etc.
        $this->build->sendStatusPostback();
        $this->build->setFinished(new \DateTime());

        // Clean up:
        $this->buildLogger->log(Lang::get('removing_build'));
        $this->build->removeBuildDirectory();

        $this->store->save($this->build);
    }
463214
public function handle()
    {
        $rows = array();

        foreach ($this->container['queue.failer']->all() as $failed)
        {
            $rows[] = $this->parseFailedJob((array) $failed);
        }

        if (count($rows) == 0)
        {
            return $this->info('No failed jobs!');
        }

        $this->table(array('ID', 'Connection', 'Queue', 'Class', 'Failed At'), $rows);
    }
610514
public function handle()
    {
        $outputPath = config('apidoc.output');

        $documentarian = new Documentarian();

        if (! is_dir($outputPath)) {
            $this->error('There is no existing documentation available at '.$outputPath.'.');

            return false;
        }
        $this->info('Rebuilding API HTML code from '.$outputPath.'/source/index.md');

        $documentarian->generate($outputPath);

        $this->info('Wrote HTML documentation to: '.$outputPath.'/index.html');
    }
1094610
public function handle()
    {
        $this->obsolete_regex = implode('|', array_map(function($key) {
            return preg_quote($key, '/');
        }, $this->config('never_obsolete_keys', [])));

        // Should commands display something
        $this->display = !$this->option('dirty');

        // Get all lemmas in a structured array
        $lemmas_structured = $this->getLemmasStructured();

        $this->line('');
        $this->line('Scan files:');

        foreach ($this->getLanguages() as $lang => $lang_path) {
            foreach ($lemmas_structured as $family => $array) {
                if ($this->option('verbose')) {
                    $this->line('');
                }

                // Set path to family file
                $file_lang_path = "{$lang_path}/{$family}.php";

                $this->line('    ' . $this->getShortPath($file_lang_path));

                // Get existing and new lemmas
                $old_lemmas = $this->getOldLemmas($file_lang_path);
                $new_lemmas = Arr::dot($array);

                // Reset the final lemma array
                $this->final_lemmas = [];
                $this->is_dirty = false;

                // Lemma processing
                $this->processNewLemmas($family, $new_lemmas, $old_lemmas);
                $this->processExistingLemmas($family, $old_lemmas, $new_lemmas);
                $this->processObsoleteLemmas($family, $old_lemmas, $new_lemmas);

                if ($this->is_dirty === true || $this->option('force')) {
                    // Sort final lemmas array by key
                    ksort($this->final_lemmas);

                    // Create a dumpy-dump
                    $this->jobs[$file_lang_path] = $this->dumpLemmas($this->final_lemmas);
                }
                else {
                    if ($this->option('verbose')) {
                        $this->line("        > <comment>Nothing to do for this file</comment>");
                    }
                }
            }
        }

        // For dirty mode, all the user wants is a return value from the
        // command. This is usually used for continuous integration.
        if ($this->option('dirty')) {
            return $this->has_new ? self::ERROR : self::SUCCESS;
        }

        // Save all lemmas
        $this->saveChanges();

        return self::SUCCESS;
    }
1332032
public function handle()
    {
        return $this->dbTransaction(function () {
            // Detach all files
            $this->block->files()->sync([]);
            $lastAction = Block::withTrashed()->find($this->block->id)->forceDelete();

            event('block.deleted', [$this->block]);

            return $lastAction;
        });
    }