To handle console command
480345
public function handle()
    {
        $alienName  = $this->input->getArgument('name');

        $alienStubs = $this->filesystem->get(__DIR__.'/../stubs/MakeAlien.txt');

        $alienStubs = str_replace([ 'dummyAlienName', 'dummyNamespace', '\\\\' ], [ $alienName, $this->app->getNamespace(), '\\' ], $alienStubs);

        if(!file_exists($filename = app_path() ."/Alien/{$alienName}Alien.php")) {
            $this->filesystem->create($filename, $alienStubs);
            $this->info("{$alienName}Alien has been created successfully.");
        } else {
            $this->info("{$alienName}Alien already exists.");
        }
    }
693963
public function handle()
    {
        // generate command class
        $commandName  = $this->input->getArgument('name');

        $commandNamespace = $this->getNamespace('Commands', $commandName);

        $commandStubs = $this->filesystem->get(__DIR__.'/../stubs/MakeCommand.txt');
        $commandStubs = str_replace([ 'dummyCommandName', 'dummyNamespace', '\\\\' ], [ basename($commandName), $commandNamespace, '\\' ], $commandStubs);

        if(!file_exists($filename = app_path() ."/Commands/{$commandName}Command.php")) {
            $this->filesystem->create($filename, $commandStubs);
            $this->info("{$commandName} command has been created successfully.");
        } else {
            $this->info("{$commandName} command already exists.");
        }

        // generate command handler class
        $commandHandlerNamespace = $this->getNamespace('Handlers', $commandName);
        $commandClassName = basename($commandName);
        $commandHandlerUse = "{$commandNamespace}\\{$commandClassName}";

        $commandHandlerStubs = $this->filesystem->get(__DIR__.'/../stubs/MakeCommand-handler.txt');
        $commandHandlerStubs = str_replace(
            [ 'dummyCommandName', 'dummyNamespace', 'dummyUse', '\\\\' ],
            [ basename($commandName), $commandHandlerNamespace, $commandHandlerUse, '\\' ], $commandHandlerStubs
        );

        if(!file_exists($filename = app_path() ."/Handlers/{$commandName}CommandHandler.php")) {
            $this->filesystem->create($filename, $commandHandlerStubs);
            $this->info("{$commandName} handler has been created successfully.");
        } else {
            $this->info("{$commandName} handler already exists.");
        }
    }
164793
public function handle()
    {

        // Start by warning the user about the command that will be run
        $this->comment('Warning! This Laravel command uses exec() to execute a ');
        $this->comment('mysql shell command to import an extracted dump. Due');
        $this->comment('to the way the command is constructed, should someone ');
        $this->comment('view the current running processes of your server, they ');
        $this->comment('will be able to see your SeAT database users password.');
        $this->line('');
        $this->line('Ensure that you understand this before continuing.');

        // Test that we have valid Database details. An exception
        // will be thrown if this fails.
        DB::connection()->getDatabaseName();

        if (! $this->confirm('Are you sure you want to update to the latest EVE SDE?', true)) {

            $this->warn('Exiting');

            return;
        }

        // Request the json from eveseat/resources
        $this->json = $this->getJsonResource();

        // Ensure we got a response, else fail.
        if (! $this->json) {

            $this->warn('Unable to reach the resources endpoint.');

            return;
        }

        // Check if we should attempt getting the
        // version string locally
        if ($this->option('local')) {

            $version_number = env('SDE_VERSION', null);

            if (! is_null($version_number)) {

                $this->comment('Using locally sourced version number of: ' . $version_number);
                $this->json->version = env('SDE_VERSION');

            } else {

                $this->warn('Unable to determine the version number override. ' .
                    'Using remote version: ' . $this->json->version);
            }
        }

        // Avoid an existing SDE to be accidentally installed again
        // except if the user explicitly ask for it
        if ($this->json->version == Seat::get('installed_sde') &&
            $this->option('force') == false
        ) {

            $this->warn('You are already running the latest SDE version.');
            $this->warn('If you want to install it again, run this command with --force argument.');

            return;
        }

        // Ask for a confirmation before installing an existing SDE version
        if ($this->option('force') == true) {

            $this->warn('You will re-download and install the current SDE version.');

            if (! $this->confirm('Are you sure ?', true)) {

                $this->info('Nothing has been updated.');

                return;
            }
        }

        //TODO: Allow for tables to be specified in config file

        // Show a final confirmation with some info on what
        // we are going to be doing.
        $this->info('The local SDE data will be updated to ' . $this->json->version);
        $this->info(count($this->json->tables) . ' tables will be updated: ' .
            implode(', ', $this->json->tables));
        $this->info('Download format will be: ' . $this->json->format);
        $this->line('');
        $this->info('The SDE will be imported to mysql://' .
            config('database.connections.mysql.username') . '@' .
            config('database.connections.mysql.host') . ':' .
            config('database.connections.mysql.port') . '/' .
            config('database.connections.mysql.database'));

        if (! $this->confirm('Does the above look OK?', true)) {

            $this->warn('Exiting');

            return;
        }

        if (! $this->isStorageOk()) {

            $this->error('Storage path is not OK. Please check permissions');

            return;
        }

        // Download the SDE's
        $this->getSde();

        $this->importSde();

        Seat::set('installed_sde', $this->json->version);

        $this->line('SDE Update Command Complete');

        // Analytics
        dispatch((new Analytics((new AnalyticsContainer)
            ->set('type', 'event')
            ->set('ec', 'queues')
            ->set('ea', 'update_sde')
            ->set('el', 'console')
            ->set('ev', $this->json->version)))
            ->onQueue('medium'));

    }
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));
    }
1078387
public function handle()
    {
        try {
            $data = $this->argument('data');
            if (filter_var($data, FILTER_VALIDATE_URL)) {
                // need to download file
                $data = FileUtilities::importUrlFileToTemp($data);
            }

            if (is_file($data)) {
                $data = file_get_contents($data);
            }

            $format = $this->option('format');
            $format = DataFormats::toNumeric($format);
            $this->comment($format);

            $service = $this->option('service');
            $resource = $this->option('resource');
            $result = ServiceManager::handleRequest($service, Verbs::POST, $resource, [], [], $data, $format, false);
            if ($result->getStatusCode() >= 300) {
                $this->error(print_r($result->getContent(), true));
            } else {
                $this->info('Import complete!');
            }
        } catch (\Exception $e) {
            $this->error($e->getMessage());
        }
    }
576974
public function handle()
    {
        // Retrieve attributes
        $attributes = config('commands.user_attributes');

        // Retrieve sensitive fields
        $sensitive_attributes = config('commands.user_attributes_sensitive');

        // Ask questions and prepare data
        foreach ($attributes as $attribute => $question) {
            if (is_null($attribute) || $attribute === 0) {
                $attribute = $question;
            }

            // Check if sensitive field
            if (in_array($attribute, $sensitive_attributes)) {
                $attributes[$attribute] = Hash::make($this->secret($question));
                continue;
            }

            $attributes[$attribute] = $this->ask($question);
        }

        // Create new user
        try {
            $user = App::make(config('commands.user'));
            $user::create($attributes);
            $this->info('User created');
        } catch (\Exception $exception) {
            $this->error($exception->getMessage());
        }
    }
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');
	}
1234430
public function handle()
    {
        $this->writeln();
        $this->writeln('Example help screen');
        $this->writeln();
        $this->writeln('Usage: helloworld [OPTIONS]');
        $this->writeln('A Hello World application to demonstrate Clip');
        $this->writeln();
        $this->writeln('Commands:');
        $this->writeln('  help       - This information screen');
        $this->writeln('  test       - A silly test example');
        $this->writeln('  flags      - Example using options.');
        $this->writeln('  profile    - Example of required --name and --age options.');
        $this->writeln('  check:name - User input example');

        $this->writeln();
        $this->exitWithSuccess();
    }
995713
void handle() throws IOException {
        if (null == handler) {
            println("Command not recognized: %s", command());
            return;
        }
        if (handler == Exit.INSTANCE) {
            handler.handle(this);
        }
        CommandLineParser parser = commandLine();
        boolean help = parser.getBoolean("-h", "--help");
        if (help) {
            Help.INSTANCE.showHelp(parser.command(), this);
        } else {
            try {
                session.handler(handler);
                handler.handle(this);
            } catch ($.Break b) {
                throw b;
            } catch (Exception e) {
                console.println("Error: " + e.getMessage());
            }
        }
    }
441279
public function handle()
    {
        $console = new Console;
        $processor = new Processor;
        $processor->install(\PulsarCMS\Packages\Installer::class);
        $processor->install(\PulsarCMS\Users\Installer::class);

        ENV::set('APP_ENV', 'production');
    }
630216
protected function handle()
    {
        $token = $this->tokens->current();

        $this->preIndent();

        if (isset(self::$map[$token[0]])) {
            $this->result .= self::$map[$token[0]];
        } else {
            if (DocLexer::T_STRING === $token[0]) {
                $this->result .= '"' . $token[1] . '"';
            } else {
                $this->result .= $token[1];
            }
        }

        $this->postIndent();
    }
477902
public function handle()
	{
		$namespace = $this->argument('namespace');

		$templateHelper = new TemplatesHelper();
		$templateData = $templateHelper->getTemplate('AppBaseController', 'Controller');

		$templateData = str_replace('$$BASE_NAMESPACE$$', $namespace, $templateData);

		$fileName = "AppBaseController.php";

		$filePath = __DIR__ . "/../../Controller/";

		$fileHelper = new FileHelper();
		$fileHelper->writeFile($filePath . $fileName, $templateData);
		$this->comment('AppBaseController generated');
		$this->info($fileName);
	}
1096452
public function handle()
    {
        $name = $this->argument('name');

        $fileSystem = new Filesystem();

        $files = $fileSystem->allFiles(__DIR__.'/../PublishedAssets/Theme');
        $this->line("\n");
        foreach ($files as $file) {
            $this->line(str_replace(__DIR__.'/../PublishedAssets/Theme/', '', str_replace('themeTemplate', strtolower($name), $file)));
        }

        $this->info("\n\nThese files will be generated\n");

        $result = $this->confirm('Are you sure you want to generate this theme?');

        if ($result) {
            foreach ($files as $file) {
                $newFileName = str_replace(__DIR__.'/../PublishedAssets/Theme', '', $file);
                $newFileName = str_replace('themeTemplate', strtolower($name), $newFileName);
                $this->line('Copying '.$newFileName.'...');
                if (is_dir($file)) {
                    $fileSystem->copyDirectory($file, base_path($newFileName));
                } else {
                    @mkdir(base_path(str_replace(basename($newFileName), '', $newFileName)), 0755, true);
                    $fileSystem->copy($file, base_path($newFileName));
                }
            }

            $sass = file_get_contents(base_path('resources/themes/'.strtolower($name).'/assets/sass/_theme.scss'));
            $sassRepairs = str_replace('themeTemplate', strtolower($name), $sass);
            file_put_contents(base_path('resources/themes/'.strtolower($name).'/assets/sass/_theme.scss'), $sassRepairs);

            $layout = file_get_contents(base_path('resources/themes/'.strtolower($name).'/layout/master.blade.php'));
            $layoutRepairs = str_replace('themeTemplate', strtolower($name), $layout);
            file_put_contents(base_path('resources/themes/'.strtolower($name).'/layout/master.blade.php'), $layoutRepairs);

            $this->info('Finished generating your theme');
            $this->line("\n");
            $this->info('Please add this to your gulpfile.js in the scripts elixir:');
            $this->comment('../../themes/'.strtolower($name).'/assets/js/theme.js');
            $this->line("\n");
            $this->info('Please add this to your app.scss:');
            $this->comment('@import "resources/themes/'.strtolower($name).'/assets/sass/_theme.scss"');
        } else {
            $this->info('Nothing has been changed or added');
        }
    }
1681
public function handle()
    {
        $events = $this->schedule->dueEvents($this->container);

        foreach ($events as $event) {
            $this->line('<info>Running scheduled command:</info> ' .$event->getSummaryForDisplay());

            $event->run($this->container);
        }

        if (count($events) === 0) {
            $this->info('No scheduled commands are ready to run.');
        }
    }
788981
public function handle()
    {
        $sql = $this->option('command');
        $connection = $this->databaseManager->connection($this->option('connection'));
        $rows = $this->castArray($connection->select($sql, [], true));
        $headers = array_keys(Arr::get($rows, 0, []));
        $this->table($headers, $rows);
    }
499560
public function handle()
    {

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

        CharacterPlanet::where('character_id', $this->getCharacterId())->get()->each(function ($planet) {

            $planet_detail = $this->retrieve([
                'character_id' => $this->getCharacterId(),
                'planet_id'    => $planet->planet_id,
            ]);

            // seed database with pins
            collect($planet_detail->pins)->each(function ($pin) use ($planet) {

                CharacterPlanetPin::firstOrNew([
                    'character_id' => $this->getCharacterId(),
                    'planet_id'    => $planet->planet_id,
                    'pin_id'       => $pin->pin_id,
                ])->fill([
                    'type_id'          => $pin->type_id,
                    'schematic_id'     => $pin->schematic_id ?? null,
                    'latitude'         => $pin->latitude,
                    'longitude'        => $pin->longitude,
                    'install_time'     => property_exists($pin, 'install_time') ?
                        carbon($pin->install_time) : null,
                    'expiry_time'      => property_exists($pin, 'expiry_time') ?
                        carbon($pin->expiry_time) : null,
                    'last_cycle_start' => property_exists($pin, 'last_cycle_start') ?
                        carbon($pin->last_cycle_start) : null,
                ])->save();

                // Collect data for the cleanup phase
                $this->planet_pins->push($pin->pin_id);

                if (property_exists($pin, 'factory_details')) {

                    CharacterPlanetFactory::firstOrNew([
                        'character_id' => $this->getCharacterId(),
                        'planet_id'    => $planet->planet_id,
                        'pin_id'       => $pin->pin_id,
                    ])->fill([
                        'schematic_id' => $pin->factory_details->schematic_id,
                    ])->save();

                    // seeding garbage collector
                    $this->planet_factories->push($pin->pin_id);
                }

                if (property_exists($pin, 'extractor_details')) {

                    CharacterPlanetExtractor::firstOrNew([
                        'character_id' => $this->getCharacterId(),
                        'planet_id'    => $planet->planet_id,
                        'pin_id'       => $pin->pin_id,
                    ])->fill([
                        'product_type_id' => $pin->extractor_details->product_type_id ?? null,
                        'cycle_time'      => $pin->extractor_details->cycle_time ?? null,
                        'head_radius'     => $pin->extractor_details->head_radius ?? null,
                        'qty_per_cycle'   => $pin->extractor_details->qty_per_cycle ?? null,
                    ])->save();

                    // Collect data for the cleanup phase
                    $this->planet_extractors->push($pin->pin_id);

                    collect($pin->extractor_details->heads)->each(function ($head) use ($planet, $pin) {

                        CharacterPlanetHead::firstOrNew([
                            'character_id' => $this->getCharacterId(),
                            'planet_id'    => $planet->planet_id,
                            'extractor_id' => $pin->pin_id,
                            'head_id'      => $head->head_id,
                        ])->fill([
                            'latitude'  => $head->latitude,
                            'longitude' => $head->longitude,
                        ])->save();

                        // seeding garbage collector
                        $this->planet_heads->push([
                            'extractor_id' => $pin->pin_id,
                            'head_id'      => $head->head_id,
                        ]);
                    });
                }

                if (property_exists($pin, 'contents')) {

                    collect($pin->contents)->each(function ($content) use ($planet, $pin) {

                        CharacterPlanetContent::firstOrNew([
                            'character_id' => $this->getCharacterId(),
                            'planet_id'    => $planet->planet_id,
                            'pin_id'       => $pin->pin_id,
                            'type_id'      => $content->type_id,
                        ])->fill([
                            'amount' => $content->amount,
                        ])->save();

                        // seeding garbage collector
                        $this->planet_contents->push([
                            'pin_id'  => $pin->pin_id,
                            'type_id' => $content->type_id,
                        ]);

                    });
                }
            });

            collect($planet_detail->links)->each(function ($link) use ($planet) {

                CharacterPlanetLink::firstOrNew([
                    'character_id'       => $this->getCharacterId(),
                    'planet_id'          => $planet->planet_id,
                    'source_pin_id'      => $link->source_pin_id,
                    'destination_pin_id' => $link->destination_pin_id,
                ])->fill([
                    'link_level' => $link->link_level,
                ])->save();

                // Collect data for the cleanup phase
                $this->planet_links->push([
                    'source_pin_id'      => $link->source_pin_id,
                    'destination_pin_id' => $link->destination_pin_id,
                ]);

            });

            collect($planet_detail->routes)->each(function ($route) use ($planet) {

                CharacterPlanetRoute::firstOrNew([
                    'character_id' => $this->getCharacterId(),
                    'planet_id'    => $planet->planet_id,
                    'route_id'     => $route->route_id,
                ])->fill([
                    'source_pin_id'      => $route->source_pin_id,
                    'destination_pin_id' => $route->destination_pin_id,
                    'content_type_id'    => $route->content_type_id,
                    'quantity'           => $route->quantity,
                ])->save();

                // seeding garbage collector
                $this->planet_routes->push($route->route_id);

                if (property_exists($route, 'waypoints')) {
                    collect($route->waypoints)->each(function ($waypoint) use ($planet, $route) {

                        CharacterPlanetRouteWaypoint::firstOrNew([
                            'character_id' => $this->getCharacterId(),
                            'planet_id'    => $planet->planet_id,
                            'route_id'     => $route->route_id,
                            'pin_id'       => $waypoint,
                        ])->save();

                        // seeding garbage collector
                        $this->planet_waypoints->push([
                            'route_id' => $route->route_id,
                            'pin_id'   => $waypoint,
                        ]);

                    });
                }
            });

            $this->planetCleanup($planet);
        });
    }
1274894
public function handle()
    {
        $this->abortCommandExecution();
        $file = $this->argument('file');
        $this->runScp(base_path($file), $this->domain, null, true);
    }