Execute the job.

@throws \Throwable
548735
public function handle()
    {

        $this->known_skills = collect();

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

        $skill_queue = $this->retrieve([
            'character_id' => $this->getCharacterId(),
        ]);

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

        collect($skill_queue)->each(function ($skill) {

            CharacterSkillQueue::firstOrNew([
                'character_id' => $this->getCharacterId(),
                'skill_id'     => $skill->skill_id,
            ])->fill([
                'finish_date'       => property_exists($skill, 'finish_date') ?
                    carbon($skill->finish_date) : null,
                'start_date'        => property_exists($skill, 'start_date') ?
                    carbon($skill->start_date) : null,
                'finished_level'    => $skill->finished_level,
                'queue_position'    => $skill->queue_position,
                'training_start_sp' => property_exists($skill, 'training_start_sp') ?
                    $skill->training_start_sp : null,
                'level_end_sp'      => property_exists($skill, 'level_end_sp') ?
                    $skill->level_end_sp : null,
                'level_start_sp'    => property_exists($skill, 'level_start_sp') ?
                    $skill->level_start_sp : null,
            ])->save();

            $this->known_skills->push($skill->skill_id);
        });

        // dropping outdated skills
        CharacterSkillQueue::where('character_id', $this->getCharacterId())
            ->whereNotIn('skill_id', $this->known_skills->toArray())
            ->delete();
    }
1089129
public function handle()
    {
        $fileSystem = new Filesystem();

        $files = $fileSystem->allFiles(__DIR__.'/../Packages/Starter');

        $this->info('These files will be published');

        foreach ($files as $file) {
            $this->line(str_replace(__DIR__.'/../Packages/Starter/', '', $file));
        }

        $result = $this->confirm('Are you sure you want to overwrite any files of the same name?');

        if ($result) {
            $this->line('Copying routes...');
            $this->copyPreparedFiles(__DIR__.'/../Packages/Starter/routes', base_path('routes'));

            $this->line('Copying config...');
            $this->copyPreparedFiles(__DIR__.'/../Packages/Starter/config', base_path('config'));

            $this->line('Copying app/Http...');
            $this->copyPreparedFiles(__DIR__.'/../Packages/Starter/app/Http', app_path('Http'));

            $this->line('Copying app/Events...');
            $this->copyPreparedFiles(__DIR__.'/../Packages/Starter/app/Events', app_path('Events'));

            $this->line('Copying app/Listeners...');
            $this->copyPreparedFiles(__DIR__.'/../Packages/Starter/app/Listeners', app_path('Listeners'));

            $this->line('Copying app/Notifications...');
            $this->copyPreparedFiles(__DIR__.'/../Packages/Starter/app/Notifications', app_path('Notifications'));

            $this->line('Copying app/Models...');
            $this->copyPreparedFiles(__DIR__.'/../Packages/Starter/app/Models', app_path('Models'));

            $this->line('Copying app/Services...');
            $this->copyPreparedFiles(__DIR__.'/../Packages/Starter/app/Services', app_path('Services'));

            $this->line('Copying database...');
            $this->copyPreparedFiles(__DIR__.'/../Packages/Starter/database', base_path('database'));

            $this->line('Copying resources/views...');
            $this->copyPreparedFiles(__DIR__.'/../Packages/Starter/resources/views', base_path('resources/views'));

            $this->line('Copying tests...');
            $this->copyPreparedFiles(__DIR__.'/../Packages/Starter/tests', base_path('tests'));

            $this->line('Adjusting Laravel default files...');
            $this->defaultFileChanger();

            $this->info("Build something worth sharing!\n");

            if ($this->confirm('Would you like to run the migration?')) {
                $this->comment('Running command: cd '.base_path().' && composer dump ...');

                exec(sprintf('cd %s && composer dump', escapeshellarg(base_path()));

                // execute migrate artisan command
                Artisan::call('migrate');
                Artisan::call('db:seed');
            } else {
                $this->info("Don't forget to run:");
                $this->comment('composer dump');
                $this->info('Then:');
                $this->comment('artisan migrate --seed');
            }
        } else {
            $this->info('You cancelled the grafite:starter');
        }
    }
1363653
public function handle()
    {
        if ($name = $this->argument('module')) {
            $module = $this->laravel['modules']->findOrFail($name);

            $this->publish($module);

            return;
        }

        foreach ($this->laravel['modules']->allEnabled() as $module) {
            $this->publish($module);
        }
    }
274449
public function handle()
    {
        if (! $this->confirmToProceed()) {
            return;
        }

        $driver = $this->getDriver();
        $database = $this->option('database');
        $id = $this->option('id');
        $pretend = $this->option('pretend', false);

        $this->prepareDatabase($driver, $database, $id);

        $migrator = $this->tenant->driver($driver);

        $this->setupMigrationOutput($migrator);

        $migrator->run($database, $id, $pretend);
    }
343392
public function handle()
    {

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

        $implants = $this->retrieve([
            'character_id' => $this->getCharacterId(),
        ]);

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

        collect($implants)->each(function ($implant) {

            CharacterImplant::firstOrCreate([
                'character_id' => $this->getCharacterId(),
                'type_id'      => $implant,
            ]);
        });

        CharacterImplant::where('character_id', $this->getCharacterId())
            ->whereNotIn('type_id', collect($implants)->flatten()->all())
            ->delete();
    }
69053
public function handle(): void
    {
        $name = $this->getNameInput();

        $path = app_path($name);

        // First we will check to see if the class already exists. If it does, we don't want
        // to create the class and overwrite the user's code. So, we will bail out so the
        // code is untouched. Otherwise, we will continue generating this class' files.
        if ($this->files->exists($path)) {
            $this->error($this->type.' already exists!');

            return;
        }

        // Next, we will generate the path to the location where this class' file should get
        // written. Then, we will build the class and make the proper replacements on the
        // stub files so that it gets the correctly formatted namespace and class name.
        $stubs = __DIR__.'/../../../resources/stubs/module';
        $this->processStubs($stubs, $path);
        $this->generateSamples();

        $this->info($this->type.' created successfully.');
    }
1350171
public function handle()
    {
        $this->line('------------------');
        $this->line('Welcome to TypiCMS');
        $this->line('------------------');

        $this->info('Publishing vendor packages...');
        $this->call('vendor:publish', ['--all' => true]);
        $this->line('------------------');

        $this->laravel['env'] = 'local';

        // Ask for database name
        $this->info('Setting up database...');
        $dbName = $this->ask('Enter a database name', $this->guessDatabaseName());

        // Set database credentials in .env and migrate
        $this->call('typicms:database', ['database' => $dbName]);
        $this->line('------------------');

        // Create a super user
        $this->createSuperUser();

        // Composer install
        if (function_exists('system')) {
            system('chmod 755 $(find storage -type d)');
            $this->info('Directory storage is now writable (755).');
            system('chmod 755 $(find bootstrap/cache -type d)');
            $this->info('Directory bootstrap/cache is now writable (755).');
            $this->line('------------------');
            $this->info('Running yarn...');
            system('yarn');
            $this->info('npm packages installed.');
        } else {
            $this->line('You can now make /storage, /bootstrap/cache directories writable.');
            $this->line('and run composer install and npm install.');
        }

        // Done
        $this->line('------------------');
        $this->line('Done. Enjoy TypiCMS!');
    }
555802
public function handle()
    {
        $version = $this->version();

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

        $currentOS = OperatingSystem::id();

        foreach ($this->slugs as $os => $slug) {
            if ($all || ($os === $currentOS)) {
                $archive = $this->download($version, $slug);

                $binary = $this->extract($archive);

                $this->rename($binary, $os);
            }
        }

        $message = 'ChromeDriver %s successfully installed for version %s.';

        $this->info(sprintf($message, $all ? 'binaries' : 'binary', $version));
    }
40682
public function fire()
    {
        // Get the payload from the job
        $payload = $this->parsePayload($this->job->payload);
        $this->name = $payload['job'];

        // Fire the actual job
        $this->resolveAndFire($payload);

        /*
         * As per l5 the documentation states that a job which has not thrown any exception by the time it finishes will
         * be deleted.
         */
        // If job is not deleted, and was not released back onto the queue, mark as finished
        if (! $this->deleted && !$this->released) {
            $this->job->status = Job::STATUS_FINISHED;
            $this->job->save();
        }
    }
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);
    }
89367
public function handle()
    {
        // Set up the keys
        $this->setupKeys();

        // Check that the keys hve been set up
        if (empty($this->old_keys) || count($this->old_keys) == 0) {
            $this->comment('Please over-ride this class with old_keys set correctly');
            exit(1);
        }

        if (empty($this->new_key)) {
            $this->comment('Please over-ride this class with old_keys set correctly');
            exit(1);
        }

        if (empty($this->tables) || count($this->tables) == 0) {
            $this->comment('Please over-ride this class with tables set correctly');
            exit(1);
        }

        // Make some encrypter objects
        $cipher        = Config::get('app.cipher');
        $baseEncrypter = new Encrypter($this->new_key, $cipher);
        $oldEncrypter  = [];
        foreach ($this->old_keys as $key => $value) {
            $oldEncrypter[$key] = new Encrypter($value, $cipher);
        }

        foreach ($this->tables as $table_name) {
            $this->comment("Fetching data from $table_name");

            // Get count of records
            $count = DB::table($table_name)
                ->count();

            // Create a progress bar
            $bar = $this->output->createProgressBar($count);

            $count = number_format($count, 0, '.', ',');
            $this->comment('Found ' . $count . ' records in DB. Checking encryption keys.');

            // Get a table object
            $table_data = DB::table($table_name);

            // Cycle through the table data 1000 records at a time
            $chunk = 1000;
            $table_data->chunk($chunk, function ($data) use ($bar, $chunk, $baseEncrypter, $oldEncrypter, $table_name) {
                foreach ($data as $datum) {
                    $datum_array = get_object_vars($datum);

                    // Check every column of the table for an encrypted value.  If the value is
                    // encrypted then try to decrypt it with the base encrypter.
                    $adjust = [];
                    foreach ($datum_array as $key => $value) {
                        if (! $this->isEncrypted($value)) {
                            continue;
                        }

                        try {
                            $test = $this->decryptedAttribute($value, $baseEncrypter);
                            continue;
                        } catch (\Exception $e) {

                            // If the base encrypter fails then try to decrypt it with each
                            // other encrypter until one works or they all fail.

                            $new_value = '';
                            foreach ($oldEncrypter as $cipher) {
                                try {
                                    $test = $this->decryptedAttribute($value, $cipher);

                                    // If that did not throw an exception then we have a match
                                    // between the old encrypter and the encrypted value, so
                                    // adjust the new value.
                                    $new_value = $this->encryptedAttribute($test, $baseEncrypter);
                                    continue;
                                } catch (\Exception $e) {
                                    // Do nothing, keep trying.
                                }
                            }

                            // If we got a match then we will have something in $new_value
                            if (empty($new_value)) {
                                Log::error(__CLASS__ . ':' . __TRAIT__ . ':' . __FILE__ . ':' . __LINE__ . ':' . __FUNCTION__ . ':' .
                                    "Unable to find an encryption key to match for ${table_name}.${key} ID " . $datum->id
                                );
                                continue;
                            }

                            // We got a match
                            $adjust[$key] = $new_value;
                        }
                    }

                    // Now if we have anything in $adjust we can write that back to the database
                    if (count($adjust) == 0) {
                        continue;
                    }

                    DB::table($table_name)
                        ->where('id', '=', $datum->id)
                        ->update($adjust);
                }

                // Advance the stick along one.
                $bar->advance($chunk);
            });

            // After each table, finish the progress bar.
            $bar->finish();
            $this->comment('');
        }

        $this->comment('All tables complete');
    }
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]);
        }
    }
1051964
public function handle()
    {
        $generator = new Generator(
            new Describer($this->db), $this->db
        );

        foreach ($generator->tables() as $schema) {
            $this->callSilent('make:migration:schema', [
                'name' => 'create_' . $schema['table'] . '_table',
                '--schema' => (new SchemaArgumentBuilder)->create($schema['columns']),
                '--model' => false
            ]);
        }

        $this->info('Migrations created successfully');
    }
942821
public function handle()
    {
        $iron = $this->container['queue']->connection();

        if ( ! $iron instanceof IronQueue)
        {
            throw new RuntimeException("Iron.io based queue must be default.");
        }

        $iron->getIron()->updateQueue($this->argument('queue'), $this->getQueueOptions());

        $this->line('<info>Queue subscriber added:</info> <comment>'.$this->argument('url').'</comment>');
    }
927314
public function handle()
    {
        $this->resource = $this->getResourceOnly();
        $this->settings = config('generators.defaults');

        $this->callModel();
        $this->callView();
        $this->callRepository();
        $this->callController();
        $this->callMigration();
        $this->callSeed();
        $this->callMigrate();

        // confirm dump autoload
        if ($this->confirm("Run 'composer dump-autoload'?")) {
            $this->composer->dumpAutoloads();
        }

        $this->info('All Done!');
        $this->info('Remember to add ' . "`Route::resource('" . str_replace('_', '-',
                $this->getCollectionName()) . "', '" . $this->getResourceControllerName() . "');`" . ' in `routes\\web.php`');
    }
791197
public function handle()
    {
        $this->showWelcomeMessage();
        $this->userSetup();
        $this->triggerPublish();
        $this->call('dashboard:fresh');
        $this->setupSeedStubs();
        $this->triggerMigrations();
        $this->createDefaultUser();
        $this->info('Setup is complete. Keep coding!');
    }
128262
public function handle()
    {
        $path = $this->cd_connector->ls("/", false, "branch")['data'];
        foreach ($path as $p){
            if($p['type']=='folder'){
                $this->info($p['value']);
            }else{
                $this->line($p['value']);
            }
        }
    }