Execute the job.

@return void
@throws \Throwable
@throws \Psr\SimpleCache\InvalidArgumentException
172831
public function handle()
    {

        if (! $this->preflighted()) return;

        // retrieve unresolved location from character
        $character_asset_locations = $this->getCharacterAssetLocations();

        // retrieve unresolved location from corporation
        $corporation_asset_locations = [];
        $corporation_owned_structures = [];

        if (in_array('Director', $this->getCharacterRoles())) {
            // retrieve location from corporation assets
            $corporation_asset_locations = $this->getCorporationAssetLocations($character_asset_locations);

            // retrieve location from corporation owned structures
            $corporation_owned_structures = $this->getCorporationStructures($character_asset_locations);
        }

        // merge structure IDs
        $location_ids = array_merge($character_asset_locations, $corporation_asset_locations, $corporation_owned_structures);

        logger()->debug('Structure resolver', ['location_ids' => $location_ids]);

        foreach ($location_ids as $location_id) {

            try {

                // If we are rate limited, stop working.
                if ($this->isRateLimited()) break;

                $structure = $this->retrieve([
                    'structure_id' => $location_id,
                ]);

                // Increment the call count we have this far.
                $this->incrementRateLimitCallCount(1);

                UniverseStructure::updateOrCreate([
                    'structure_id' => $location_id,
                ], [
                    'name'            => $structure->name,
                    'owner_id'        => $structure->owner_id,
                    'solar_system_id' => $structure->solar_system_id,
                    'x'               => $structure->position->x,
                    'y'               => $structure->position->y,
                    'z'               => $structure->position->z,
                    'type_id'         => $structure->type_id ?? null,
                ]);

            } catch (RequestFailedException $e) {

                // Failure to grab the structure should result in us creating an
                // empty entry in the database for this structure.

                $model = UniverseStructure::firstOrNew([
                    'structure_id' => $location_id,
                ])->fill([
                    'name'            => 'Unknown Structure',
                    'owner_id'        => null,
                    'solar_system_id' => 0,
                    'x'               => 0.0,
                    'y'               => 0.0,
                    'z'               => 0.0,
                    'type_id'         => null,
                ]);

                // persist the structure only if it doesn't already exist
                if (! $model->exists)
                    $model->save();
            }
        }
    }
568135
public function handle()
    {
        if (! $this->confirmToProceed()) {
            return;
        }

        $this->prepareDatabase();

        // Next, we will check to see if a path option has been defined. If it has
        // we will use the path relative to the root of this installation folder
        // so that migrations may be run for any path within the applications.
        $this->migrator->setOutput($this->output)
                ->run($this->getMigrationPaths(), [
                    'pretend' => $this->option('pretend'),
                    'step' => $this->option('step'),
                ]);

        // Finally, if the "seed" option has been given, we will re-run the database
        // seed task to re-populate the database, which is convenient when adding
        // a migration and a seed at the same time, as it is only this command.
        if ($this->option('seed') && ! $this->option('pretend')) {
            $this->call('db:seed', ['--force' => true]);
        }
    }
47786
protected function job(): void
    {
        while (true) {

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

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

            collect($orders)->each(function ($order) {

                CorporationOrder::firstOrNew([
                    'corporation_id' => $this->getCorporationId(),
                    'order_id'       => $order->order_id,
                ])->fill([
                    'type_id'         => $order->type_id,
                    'region_id'       => $order->region_id,
                    'location_id'     => $order->location_id,
                    'range'           => $order->range,
                    'is_buy_order'    => $order->is_buy_order ?? null,
                    'price'           => $order->price,
                    'volume_total'    => $order->volume_total,
                    'volume_remain'   => $order->volume_remain,
                    'issued'          => carbon($order->issued),
                    'issued_by'       => $order->issued_by,
                    'min_volume'      => $order->min_volume ?? null,
                    'wallet_division' => $order->wallet_division ?? null,
                    'duration'        => $order->duration ?? null,
                    'escrow'          => $order->escrow ?? null,
                ])->save();
            });

            if (! $this->nextPage($orders->pages))
                return;
        }
    }
1213733
public function handle()
    {
        $basePath = $this->getMigrationPath();
        $migrations = $this->migrator->getMigrationFiles($basePath, false);
        $count = count($migrations);

        if ($count == 0) {
            $this->comment('No migrations to move');

            return;
        }

        foreach ($migrations as $migration_name => $migration_path) {
            $datePath = $this->migrator->getDateFolderStructure($migration_name);

            // Create folder if it does not already exist
            if (! $this->files->exists($basePath.'/'.$datePath)) {
                $this->files->makeDirectory($basePath.'/'.$datePath, 0775, true);
            }

            // Move the migration into its new folder
            $this->files->move($basePath.'/'.$migration_name.'.php', $basePath.'/'.$datePath.$migration_name.'.php');
        }

        $this->info('Migrations organised successfully ('.$count.' migrations moved)');
    }
167289
public function handle()
    {
        $content = $this->dbTransaction(function () {
            $content = new Content();
            $content->fill([
                'type'               => $this->attributes['type'],
                'theme'              => $this->attributes['theme'],
                'weight'             => $this->attributes['weight'],
                'rating'             => $this->attributes['rating'],
                'is_on_home'         => $this->attributes['is_on_home'],
                'is_promoted'        => $this->attributes['is_promoted'],
                'is_sticky'          => $this->attributes['is_sticky'],
                'is_comment_allowed' => $this->attributes['is_comment_allowed'],
                'published_at'       => $this->attributes['published_at']
            ]);
            $content->author()->associate($this->author);

            if ($this->attributes['parent_id']) {
                $parent = Content::find($this->attributes['parent_id']);
                if (!$parent) {
                    throw new InvalidArgumentException('Parent not found');
                }

                $content->setChildOf($parent);
            } else {
                $content->setAsRoot();
            }

            $translation = new ContentTranslation();
            $translation->fill([
                'title'           => $this->title,
                'language_code'   => $this->language->code,
                'teaser'          => $this->attributes['teaser'],
                'body'            => $this->attributes['body'],
                'seo_title'       => $this->attributes['seo_title'],
                'seo_description' => $this->attributes['seo_description'],
                'is_active'       => true,
            ]);
            $translation->author()->associate($this->author);

            $content->translations()->save($translation);
            $content->createRoute($translation, $this->attributes['is_active']);

            event('content.created', [$content]);
            return $content;
        });
        return $content;
    }
249540
public function handle()
    {
        if (!$this->confirmToProceed()) {
            return;
        }

        $this->prepareDatabase();

        $path = $this->getMappingPath();

        $this->mapper->run($path, [
            'step'  => $this->option('step'),
            'index' => $this->option('index'),
        ]);

        // Once the mapper has run we will grab the note output and send it out to
        // the console screen, since the mapper itself functions without having
        // any instances of the OutputInterface contract passed into the class.
        foreach ($this->mapper->getNotes() as $note) {
            $this->output->writeln($note);
        }
    }
228747
public function handle()
    {
        if (!$this->confirmToProceed()) {
            return;
        }

        $this->prepareDatabase();

        // Next, we will check to see if a path option has been defined. If it has
        // we will use the path relative to the root of this installation folder
        // so that migrations may be run for any path within the applications.
        $this->migrator->run($this->getMigrationPaths(), [
            'pretend' => $this->option('pretend'),
            'step' => $this->option('step'),
        ]);
		
        // Once the migrator has run we will grab the note output and send it out to
        // the console screen, since the migrator itself functions without having
        // any instances of the OutputInterface contract passed into the class.
        foreach ($this->getMigratorNotes() as $note) {
            $this->output->writeln($note);
        }

        // Finally, if the "seed" option has been given, we will re-run the database
        // seed task to re-populate the database, which is convenient when adding
        // a migration and a seed at the same time, as it is only this command.
        if ($this->option('seed')) {
            $this->call('db:seed', ['--force' => true]);
        }
    }
413997
public function execute()
	{
		// Incoming task
		$this->_task = strtolower(Request::getCmd('task', ''));

		$doTask = null;

		// Check if the default task is set
		if (!$this->_task)
		{
			if (isset($this->_taskMap['__default']))
			{
				$doTask = $this->_taskMap['__default'];
			}
		}
		// Check if the task is in the taskMap
		else if (isset($this->_taskMap[$this->_task]))
		{
			$doTask = $this->_taskMap[$this->_task];
		}

		// Raise an error (hopefully, this shouldn't happen)
		if (!$doTask)
		{
			throw new InvalidTaskException(Lang::txt('JLIB_APPLICATION_ERROR_TASK_NOT_FOUND', $this->_task), 404);
		}

		// Record the actual task being fired
		$doTask .= 'Task';

		// Call the task
		$this->$doTask();
	}
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);
    }
231321
public function handle()
    {
        // Make a storage disk for the cache location
        $cacheDisk = [
            'driver'=>'local',
            'root'=>config('cache.stores.file.path')
        ];
        \Config::set('filesystems.disks.fcache',$cacheDisk);
        $expired_file_count = 0;
        $active_file_count = 0;

        // Grab the cache files
        $files = \Storage::disk('fcache')->allFiles();

        // Loop the files and get rid of any that have expired
        foreach($files as $key=>$cachefile) {
            // Ignore this file
            if($cachefile == '.gitignore') {
                continue;
            }

            try {
                // Grab the contents of the file
                $contents = \Storage::disk('fcache')->get($cachefile);

                // Get the expiration time
                $expire = substr($contents, 0, 10);

                // See if we have expired
                if(time() >= $expire) {
                    // Delete the file
                    \Storage::disk('fcache')->delete($cachefile);
                    $expired_file_count++;
                } else {
                    $active_file_count++;
                }
            } catch(\Illuminate\Contracts\Filesystem\FileNotFoundException $e) {
                // Getting an occasional error of this type on the 'get' command above,
                // so adding a try-catch to skip the file if we do.
            }
        }

        $this->line('Total expired cache files removed: '.$expired_file_count);
        $this->line('Total active cache files remaining: '.$active_file_count);
    }
339974
public function handle()
    {
        $input = $this->getCommandInput();

        if ($input->tableExists) {
            $input->withMigration = false;

            $this->createResourceFile($input);
        }

        $resources = Resource::fromFile($input->resourceFile, $input->languageFileName ?: 'generic');

        $this->validateField($resources->fields)
            ->printInfo('Scaffolding resources for ' . $this->modelNamePlainEnglish($input->modelName) . '...')
            ->createModel($input)
            ->createController($input)
            ->createRoutes($input)
            ->createLanguage($input)
            ->createViews($input)
            ->createMigration($input)
            ->info('Done!');
    }
923727
public function handle()
	{
		parent::handle();

		$followRepoPattern = $this->confirm("\nDo you want to generate repository ? (y|N)", false);

		$migrationGenerator = new MigrationGenerator($this->commandData);
		$migrationGenerator->generate();

		$modelGenerator = new ModelGenerator($this->commandData);
		$modelGenerator->generate();

		if($followRepoPattern)
		{
			$repositoryGenerator = new RepositoryGenerator($this->commandData);
			$repositoryGenerator->generate();

			$repoControllerGenerator = new RepoAPIControllerGenerator($this->commandData);
			$repoControllerGenerator->generate();
		}
		else
		{
			$controllerGenerator = new APIControllerGenerator($this->commandData);
			$controllerGenerator->generate();
		}

		$routeGenerator = new RoutesGenerator($this->commandData);
		$routeGenerator->generate();

		if($this->confirm("\nDo you want to migrate database? [y|N]", false))
			$this->call('migrate');
	}
1369407
public function fire()
	{
		if ($this->option('files') != '')
		{
			$seeder = $this->getLaravelSeeder();

			$seeder->only($this->option('files'));

			$this->call('db:seed');

			$seeder->restore();

			if ($seeder->getSeeded() == 0)
			{
				$this->info('No seeders were ran!');
			}
		}
		else
		{
			throw new \InvalidArgumentException('The "--files" option is required.');
		}
	}
592023
public function handle()
    {
        $this->parseKey();

        $this->files = $this->filesFromKey();

        try {
            $this->languages = $this->getLanguages();
        } catch (InvalidArgumentException $e) {
            $this->error($e->getMessage());

            return;
        }

        $this->table(
            array_merge(['key'], $this->languages),
            $this->tableRows()
        );
    }
470604
public function handle()
    {
        $options = $this->options();
        foreach (['host', 'port', 'username', 'secret'] as $key) {
            $value = Arr::get($options, $key, null);
            $value = is_null($value) ? Arr::get($this->config, $key, null) : $value;
            $options[$key] = $value;
        }
        $client = $this->connector->create($options);
        $client->then([$this, 'client'], [$this, 'writeException']);
        $this->loop->run();
    }
1193538
public function handle()
    {
        $failed = $this->container['queue.failer']->find($this->argument('id'));

        if ( ! is_null($failed))
        {
            $failed->payload = $this->resetAttempts($failed->payload);

            $this->container['queue']->connection($failed->connection)->pushRaw($failed->payload, $failed->queue);

            $this->container['queue.failer']->forget($failed->id);

            $this->info('The failed job has been pushed back onto the queue!');
        }
        else
        {
            $this->error('No failed job matches the given ID.');
        }
    }
445001
public function execute()
    {
        if ($this->state === self::STATE_WAITING) {
            $this->state = self::STATE_RUNNING;
            foreach ($this->jobs as $name => $cb) {
                $cb($name, $this);
                $this->jobs[$name] = null;
            }
            $this->checkIfAllReady();
        }
    }