Executes the console command.

@return mixed
14974
public function handle()
    {
        $input = $this->getCommandInput();
        $file = $this->getFilename($input->file);

        if (Config::autoManageResourceMapper()) {
            $mapper = new ResourceMapper($this);
            $mapper->reduce($input->modelName, $input->file);
        }

        if (!$this->isFileExists($file)) {
            $this->error('The resource-file does not exists.');

            return false;
        }

        $this->deleteFile($file);
        $this->info('The "' . basename($file) . '" file was successfully deleted!');
    }
487870
public function handle()
    {
        $arguments = $this->argument();
        $option = $this->option();
        $options = [];

        array_walk($option, function (&$value, $key) use (&$options) {
            $options['--' . $key] = $value;
        });

        unset($arguments['slug']);
        unset($options['--location']);

        $modulePath = module_path($this->argument('slug'), 'Database/Migrations', $this->option('location'));
        $options['--path'] = str_replace(realpath(base_path()), '', realpath($modulePath));
        $options['--path'] = ltrim($options['--path'], '/');

        return $this->call('make:migration', array_merge($arguments, $options));
    }
190397
public function handle()
    {
        $this->info(sprintf('%s (v%s)', config('setup.title'), self::VERSION));

        $pretend = (bool) $this->option('pretend');
        $steps   = (array) $this->argument('step');
        $return  = $this->runSteps($steps, $pretend);

        $this->info('Setup finished.');

        return $return;
    }
1286894
public function handle()
    {
        if (! $this->confirmToProceed()) {
            return;
        }

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

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

            if ($this->packages->isEnabled($slug)) {
                $this->seed($slug);
            } else if ($this->option('force')) {
                $this->seed($slug);
            }

            return;
        }

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

        foreach ($packages as $package) {
            $slug = $package['slug'];

            $this->seed($slug);
        }
    }
966864
public function handle()
    {
        $target = $this->argument('target');
        $options = [
            'compress' => $this->option('compress'),
            'json' => $this->option('json'),
            'no-lib' => $this->option('no-lib'),
            'source' => $this->option('source'),
        ];

        if ($this->generator->generate($target, $options)) {
            $this->info("Created: {$target}");

            return;
        }

        $this->error("Could not create: {$target}");
    }
486387
public function handle()
    {

        $this->connection = $this->option("connection") ? $this->option("connection") : config("es.default");

        $this->size = (int)$this->option("bulk-size");

        $this->scroll = $this->option("scroll");

        if ($this->size <= 0 or !is_numeric($this->size)) {
            return $this->warn("Invalide size value");
        }

        $original_index = $this->argument('index');

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

        if (!in_array($original_index, array_keys(config("es.indices")))) {
            return $this->warn("Missing configuration for index: {$original_index}");
        }

        if (!in_array($new_index, array_keys(config("es.indices")))) {
            return $this->warn("Missing configuration for index: {$new_index}");
        }

        $this->migrate($original_index, $new_index);
    }
1230892
public function handle()
    {
        $this->laravel['events']->dispatch(
            'cache:clearing', [$this->argument('store'), $this->tags()]
        );

        $successful = $this->cache()->flush();

        $this->flushFacades();

        if (! $successful) {
            return $this->error('Failed to clear cache. Make sure you have the appropriate permissions.');
        }

        $this->laravel['events']->dispatch(
            'cache:cleared', [$this->argument('store'), $this->tags()]
        );

        $this->info('Application cache cleared!');
    }
373854
public function handle()
    {
        $this->bootstrap();

        $middleware = array_merge(
            $this->middleware,
            $this->router->getRouteMiddleware()
        );

        return $this->sendThroughPipeline($middleware, function () {
            return $this->router->execute($this);
        });
    }
157824
public function handle()
    {
        $this->tables = $this->getTablesFromMWBFile();
        if ($this->tables === false) {
            return false;
        }
        $this->getAppJson();

        $success = $this->validateTableSchema();
        if (!$success) {
            return false;
        }

        return true;
    }
1011116
public function handle()
    {
        $continue = true;
        $this->rollback = $this->option('rollback');
        $this->loadPluginDevUtilities();
        if ($this->rollback) {
            $pluginDevUtilities = $this->pluginDevUtilities;
            if (
                isset($pluginDevUtilities['current']) &&
                isset($pluginDevUtilities['old']) &&
                isset($pluginDevUtilities['replace']) &&
                isset($pluginDevUtilities['replace-rollback'])
            ) {
                $this->pluginDevUtilities['old'] = $pluginDevUtilities['current'];
                $this->pluginDevUtilities['current'] = $pluginDevUtilities['old'];
                $this->pluginDevUtilities['replace'] = $pluginDevUtilities['replace-rollback'];
            } else {
                $this->error("File: developer.json is corrupted.");
                $continue = false;
            }

        } else {
            $this->loadPluginUtilitiesToProcess();
        }
        if ($continue) {
            $continue = $this->printConfirmablePluginUtilitiesTable();
        }
        if ($continue) {
            $continue = $this->printConfirmablePluginNamespaceTable();
        }
        if ($continue) {
            $this->renamePluginUtilities();
            $res = `composer dump-autoload --optimize`;
            if ($this->pluginDevUtilities['old']['slug'] != $this->pluginDevUtilities['current']['slug']) {
                $res = `npm run dev`;
            }

            if (!$this->rollback) {
                $replaceRollback = [];
                if (
                    isset($this->pluginDevUtilities['replace']) &&
                    is_array($this->pluginDevUtilities['replace'])
                ) {

                    foreach ($this->pluginDevUtilities['replace'] as $key => $val) {
                        $replaceRollback[$val] = $key;
                    }
                    $replaceRollback = array_reverse($replaceRollback);
                }
                $this->pluginDevUtilities['replace-rollback'] = $replaceRollback;
            } else {
                $this->pluginDevUtilities['replace'] = $pluginDevUtilities['replace'];
                unset($this->pluginDevUtilities['old']);
                unset($this->pluginDevUtilities['replace-rollback']);
            }
            $this->plugin['files']->put($this->developerFile, json_encode($this->pluginDevUtilities, JSON_PRETTY_PRINT));

            $this->info("Process Complete... Check the result from your Wordpress Dashboard.");
            if (!$this->rollback) {
                if ($this->confirm("Type yes to rolling back, if fatal error occured.")) {
                    $this->call("plugin:rename", ['--rollback' => true]);
                }
            }
        }
667704
public function handle() {
        $connectionName = $this->option('connection');
        if (!empty($connectionName)) {
            $connectionInfo = config('database.connections.' . $connectionName);
            if (!is_array($connectionInfo)) {
                $this->line("- There is no configuration info for connection '{$connectionName}'");
                return;
            }
            $connection = DbConnectionsManager::createConnectionFromArray($connectionName, $connectionInfo);
        } else {
            $connection = DbConnectionsManager::getConnection('default');
        }
        $tableName = $this->argument('table_name');
        $schemaName = $this->argument('schema') ?: $connection->getConnectionConfig()->getDefaultSchemaName();
        if (
            !$connection->hasTable($tableName, $schemaName)
            && !$this->confirm("Table {$schemaName}.{$tableName} does not exist. Continue?", true)
        ) {
            return;
        }
        /** @var ClassBuilder $builder */
        $builderClass = $this->getClassBuilderClass();
        $builder = new $builderClass(
            $tableName,
            $connection
        );
        $builder->setDbSchemaName($schemaName);

        $only = $this->option('only');
        $overwrite = null;
        if (in_array($this->option('overwrite'), ['1', 'yes', 'y'], true)) {
            $overwrite = true;
        } else if (in_array($this->option('overwrite'), ['0', 'no', 'n'], true)) {
            $overwrite = false;
        }

        $info = $this->preapareAndGetDataForViews();

        if (!$only || $only === 'table') {
            $this->createTableClassFile($builder, $info, $overwrite);
        }
        if (!$only || $only === 'record') {
            $this->createRecordClassFile($builder, $info, $overwrite);
        }
        if (!$only || $only === 'structure') {
            $this->createTableStructureClassFile($builder, $info, $overwrite);
        }

        $this->line('Done');
    }
967136
public function handle()
    {
        if (! $this->confirmToProceed()) {
            return;
        }

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

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

        $this->call('package:migrate:reset', array(
            'slug'       => $slug,
            '--database' => $this->option('database'),
            '--force'    => $this->option('force'),
            '--pretend'  => $this->option('pretend'),
        ));

        $this->call('package:migrate', array(
            'slug'       => $slug,
            '--database' => $this->option('database'),
        ));

        if ($this->needsSeeding()) {
            $this->runSeeder($slug, $this->option('database'));
        }

        $this->info('Package has been refreshed.');
    }
670218
public function handle()
    {
        $path = $this->argument('path');
        $lines = (int) $this->option('lines');

        if (empty($path) === false) {
            $root = function_exists('base_path') === true ? base_path() : getcwd();
            $file = rtrim($root, '/').'/'.$path;
        } else {
            $path = function_exists('storage_path') === true ? storage_path() : getcwd();
            $path = rtrim($path, '/').'/';

            $file = (new Collection($this->files->glob($path.'logs/*.log')))
                ->map(function ($file) {
                    return is_file($file) === true ? $file : false;
                })->sortByDesc(function ($file) {
                    return filectime($file);
                })->first();
        }

        $this->readLine($file, $lines);
    }
59415
public function handle()
    {
        $data = [
            'value'      => $this->argument('ip'),
            'enabled'    => !$this->option('disabled'),
            'trusted'    => $this->option('trusted'),
            'reason'     => $this->option('reason'),
            'expired_at' => $this->option('expire'),
        ];

        $this->rulesProcessor->store($this, $data, $this->option('canBanSelf'));
    }
394990
public function handle()
    {
        $countries = [];

        $data = $this->loader->load('en');
        foreach ($data as $key => $name) {
            $countries[] = [
                'name' => $name,
                'code' => "${key}",
            ];
        }

        $countries = Collection::make($countries);

        $hash = md5($countries->toJson());

        if (!$this->option('force') && $hash === $this->hash) {
            $this->line("No new country.");
            return false;
        }

        $countryCodes = $countries->pluck('code')->unique();

        $existingCountryIDs = Collection::make(
            DB::table($this->countries)->whereIn('code', $countryCodes)->pluck('id', 'code')
        );

        $countries = $countries->map(function ($item) use ($existingCountryIDs) {
            if ($existingCountryIDs->has($item['code'])) {
                $item['id'] = $existingCountryIDs->get($item['code']);
            }

            return $item;
        });

        $countries = $countries->groupBy(function ($item) {
            return array_has($item, 'id') ? 'update' : 'create';
        });

        DB::transaction(function () use ($countries, $hash) {
            $create = $countries->get('create', Collection::make());
            $update = $countries->get('update', Collection::make());

            foreach ($create->chunk(static::QUERY_LIMIT) as $entries) {
                DB::table($this->countries)->insert($entries->toArray());
            }

            foreach ($update as $entries) {
                DB::table($this->countries)->where('id', $entries['id'])->update($entries);
            }
            $this->line("{$create->count()} countries created. {$update->count()} countries updated.");
            $this->files->put(storage_path(static::INSTALL_HISTORY), $hash);
        });

        return true;
    }
530731
public function handle()
    {
        $name    = $this->argument('name');
        $path    = config_path('site.php');
        $content = $this->files->get($path);

        $content = str_replace('%%NAME%%', $name, $content);
        $this->files->put($path, $content);

        return true;
    }
6839
public function handle()
    {
        $this->tables = $this->getTablesFromMWBFile();
        if ($this->tables === false) {
            return false;
        }
        $this->getAppJson();

        $this->databaseService = new DatabaseService($this->config, $this->files);
        $this->databaseService->resetDatabase();

        $this->generateMigration();

        $this->databaseService->dropDatabase();

        return true;
    }