Execute the job.

@throws \Throwable
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);
        });
    }
213437
public function handle()
    {
        $this->call('key:generate');
        $this->call('storage:link');

        $this->call('vendor:publish', [
            '--provider' => BlogServiceProvider::class
        ]);
        /*$this->call('vendor:publish', [
            '--provider' => PermissionServiceProvider::class,
            '--tag' => 'migrations'
        ]);*/
        $this->call('migrate');

        $this->info('Attempting to set User model as parent to App\User');
        if (file_exists(app_path('User.php'))) {
            $str = file_get_contents(app_path('User.php'));

            if ($str !== false) {
                $str = str_replace('extends Authenticatable', "extends \Tanwencn\Blog\Database\Eloquent\User", $str);

                file_put_contents(app_path('User.php'), $str);
            }
        } else {
            $this->warn('Unable to locate "app/User.php".  Did you move this file?');
            $this->warn('You will need to update this manually.  Change "extends Authenticatable" to "extends \Tanwencn\Blog\Database\Eloquent\User" in your User model');
        }

        $this->call('blog:registerPermissions');
    }
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();
	}
1209051
public function handle()
    {

        if ($class = $this->option('class')) {
            $classes = [$class];
        } else {
            $directory = $this->option('dir') ?: app_path();
            $classes = (new FindCacheableClasses($directory))->getAllCacheableClasses();
        }
        foreach ($classes as $className) {
            $this->rebuild($className);
        }
    }
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!');
    }
614672
public function handle()
    {
        // It's possible for the developer to specify the tables to modify in this
        // schema operation. The developer may also specify if this table needs
        // to be freshly created so we can create the appropriate migrations.
        $name = trim($this->input->getArgument('name'));

        $table = $this->input->getOption('table');
        $content = $this->input->getArgument('content');
        $create = $this->input->getOption('create') ?: false;

        // If no table was given as an option but a create option is given then we
        // will use the "create" option as the table name. This allows the devs
        // to pass a table name into this option as a short-cut for creating.
        if (! $table && is_string($create)) {
            $table = $create;

            $create = true;
        }

        // Now we are ready to write the migration out to disk. Once we've written
        // the migration out, we will dump-autoload for the entire framework to
        // make sure that the migrations are registered by the class loaders.
        $this->writeMigration($name, $table, $create,$content);

        $this->composer->dumpAutoloads();
    }
63946
public function handle()
    {
        // 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->getQueue(
            $connection = $this->input->getArgument('connection')
        );

        $this->listener->listen(
            $connection, $queue, $this->gatherOptions()
        );
    }
60101
public function handle()
    {
        $exportPath = $this->option('path');

        if($exportPath) {
            if(!file_exists($exportPath)) {
                throw new \Exception('Path '.$exportPath. ' does not exists!');
            }
        }else{
            $exportPath = storage_path('app/dumper');

            // create dumper directory
            if(!file_exists($exportPath)) {
                File::makeDirectory($exportPath, 0755);
            }
        }

        $filePath = $exportPath.'/'.date("Ymdhisi").'.sql';
      
        $this->comment("Starting database dump...");

        switch (config('database.default')){
        case 'mysql':
            MySql::create()
                ->setDbName(config('database.connections.mysql.database'))
                ->setHost(config('database.connections.mysql.host'))
                ->setUserName(config('database.connections.mysql.username'))
                ->setPassword(config('database.connections.mysql.password'))
                ->dumpToFile($filePath);
            break;

        case 'pgsql':
            PostgreSql::create()
                ->setDbName(config('database.connections.pgsql.database'))
                ->setUserName(config('database.connections.pgsql.username'))
                ->setPassword(config('database.connections.pgsql.password'))
                ->dumpToFile($filePath);
            break;

        case 'sqlite':
            Sqlite::create()
                ->setDbName(config('database.connections.sqlite.database'))
                ->dumpToFile($filePath);
            break;

        case 'mongodb':
            MongoDb::create()
                ->setDbName(config('database.connections.mongodb.database'))
                ->setUserName(config('database.connections.mongodb.username'))
                ->setPassword(config('database.connections.mongodb.password'))
                ->dumpToFile($filePath);
            break;
        }

        $this->info("Database successfully dumped to ".$filePath);
    }
487855
public function handle()
    {

        $this->exceptionName = $this->formatModel($this->argument('ExceptionName'));

        $this->view = $this->formatModelPath($this->exceptionName);

        $this->setCommandType($this->argument('command'));

        $this->setExceptionPaths();

        if ( $this->deleteFiles() ) {

            $this->sendSuccessMessage();

            return;

        }

        $this->error('No Such Directory');


    }
1288968
public function handle(): void
    {
        $this->initCommands();

        foreach ($this->calls as $info) {
            if (! isset($info['command'])) {
                continue;
            }

            $params = (isset($info['params'])) ? $info['params'] : [];

            $this->line(PHP_EOL.$info['description']);

            switch ($info['type']) {
                case 'artisan':
                    $this->call($info['command'], $params);
                    break;
                case 'cli':
                    $process = new Process($info['command']);
                    $process->run();
                    break;
            }
        }
    }
1086794
public function handle()
    {

        // setup for crud

        $this->modelName = $this->formatModel($this->argument('ModelName'));

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



        $this->setCrudTokens();


        $this->setFilePaths();



        // setup for views

        $this->setConfigFromInputs();


        // runs all commands

        if  ($this->makeCrudFiles() &&
             $this->makeViewDirectory()->makeViewFiles($this->templateType)){

            $this->sendSuccessMessage();

            return;

        }


        $this->error('Oops, something went wrong!');


    }
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);
	}
62510
public function handle()
    {
        \tap($this->tenant->driver($this->getDriver()), function ($migrator) {
            $this->setupMigrationOutput($migrator);

            $migrator->install(
                $this->option('database'), $this->option('id')
            );
        });
    }
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);
            }
        }
    }
557819
public function handle()
    {
        $name = $this->qualifyClass($this->getNameInput());

        $names = [
            $name . '.index',
            $name . '.show',
            $name . '.create',
            $name . '.edit',
        ];

        foreach ($names as $key => $name) {
            $path = $this->getPath($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->alreadyExists($name)) {
                $this->error($name.' already exists!');
                continue;
            }

            // 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.
            $this->makeDirectory($path);

            $this->files->put($path, $this->buildClass($name));

            $this->info($name.' created successfully.');
        }
    }
126294
public function handle()
    {
        $this->identifier = self::normalize($this->argument('identifier'));

        $this->askImageUploads();
        $this->askFileUploads();
        $this->askMigration();
        $this->askActions();

        $this->compiler = new ResourceCompiler($this, $this->identifier, $this->resourceOptions);

        $this->createResource('config');
        $this->createResource('model');
        $this->createResource('request');
        $this->createResource('controller');

        if ($this->resourceOptions['migration']) {
            $this->createResource('migration');
        }
    }
249384
public function handle()
    {
        $name = ucfirst($this->argument('name'));

        // Create the CRUD Controller and show output
        Artisan::call('sone:crud-controller', ['name' => $name]);
        echo Artisan::output();

        // Create the CRUD Model and show output
        Artisan::call('sone:crud-model', ['name' => $name]);
        echo Artisan::output();

        // Create the CRUD Request and show output
        Artisan::call('sone:crud-request', ['name' => $name]);
        echo Artisan::output();
    }