Execute the console command.

@return mixed
@throws \Gitonomy\Git\Exception\RuntimeException
@throws \Gitonomy\Git\Exception\InvalidArgumentException
494898
public function handle()
    {
        $inspector = new Inspector($this->settings);

        $repository = $inspector->getRepositoryByUrl($this->argument('repositoryUrl'));

        $inspectedRepository = $inspector->inspectRepository($repository);

        $header = array_keys((array)$inspectedRepository[key($inspectedRepository)]);

        if(!$this->option('dry-run')){
            $remote = $inspectedRepository['remote'];


            \Swis\GotLaravel\Models\Results::unguard();

            foreach($inspectedRepository['results'] as $result){
                $insert = $result->toArray();
                $insert['remote'] = $remote;
                $insert['author_slug'] = Str::slug($result->getAuthor());
                $insert['created_at'] = Carbon::createFromTimestamp($insert['date']);
                try {
                    \Swis\GotLaravel\Models\Results::updateOrCreate(array_only($insert, ['remote', 'filename', 'line']), $insert);
                } catch(\Exception $e){
                    $this->error('Couldnt insert: ' . $e->getMessage() . PHP_EOL . print_r($insert,1));
                }
            }
        }

        reset($inspectedRepository['results']);
        array_walk(
            $inspectedRepository['results'],
            function (&$row) {
                $row = $row->toArray();
            }
        );

        $this->info($inspectedRepository['remote']);
        $this->table($header, $inspectedRepository['results']);


        Artisan::call('got:normalize-names');
    }
211839
public function handle()
	{
		$days = (int)$this->option( 'days' );

		if ( $days < 0 )
		{
			$this->writeError( "days option cannot be negative" );

			return self::ERROR;
		}

		$success = $this->manager->deleteBackupFiles( $this->lang_folder_path , $days , $this->option( 'dry-run' ) );

		return ( $success === true ) ? self::SUCCESS : self::ERROR;
	}
584083
public function handle()
    {
        /*
         * Lookup plugin
         */
        $pluginName = $this->argument('name');
        $pluginName = PluginManager::instance()->normalizeIdentifier($pluginName);
        if (!PluginManager::instance()->exists($pluginName)) {
            throw new \InvalidArgumentException(sprintf('Plugin "%s" not found.', $pluginName));
        }

        $manager = UpdateManager::instance()->setNotesOutput($this->output);

        /*
         * Rollback plugin
         */
        $manager->rollbackPlugin($pluginName);

        /*
         * Update plugin
         */
        $this->output->writeln('<info>Reinstalling plugin...</info>');
        $manager->updatePlugin($pluginName);
    }
13969
public function handle()
    {
        try {

            // replace all space after ucwords
            $class_name = preg_replace('/\s+/', '', ucwords($this->argument('name')));

            //retrieves store directory configuration
            $directory = $this->option('directory') ? $this->appPath($this->option('directory')) : $this->appPath($this->config->get('fractal.directory'));

            $model = ucwords($this->option('model'));

            $modelClass = $this->getModelNamespace($model);

            $transformerAttrs = $this->getModelColumns($model);

            //retrieves namespace configuration
            $namespace = $this->option('namespace') ? $this->option('namespace') : $this->config->get('fractal.namespace');

            list($class, $namespace, $directory) = $this->getTransformerProperties($class_name, $namespace, $directory);

            is_dir($directory) ?: $this->filesystem->makeDirectory($directory, 0755, true);

            $create = true;

            // transformer store path
            $transformer = "{$directory}/{$class}";

            if ($this->filesystem->exists("{$transformer}.php")) {
                if ($usrResponse = strtolower($this->ask("The filesystem ['{$class}'] already exists, overwrite? [y/n]",
                    null))
                ) {
                    switch ($usrResponse) {
                        case 'y':
                            $backupFile = "{$directory}/{$class}.php";

                            while ($this->filesystem->exists($backupFile)) {
                                $prefix = (new \DateTime())->format('Y_m_d_His');
                                $backupFile = "{$directory}/{$prefix}_{$class}.php";
                            }
                            rename("{$directory}/{$class}.php", $backupFile);
                            $this->info("A backup has been generated at {$backupFile}");
                            break;
                        default:
                            $this->info('No filesystem has been created.');
                            $create = false;
                    }
                }
            }

            // loading transformers template from views
            $view = $this->view->make('fractal::transformer',
                [
                    'namespace'   => $namespace,
                    'class_name'  => $class,
                    'attributes'  => $transformerAttrs,
                    'modelClass'  => $model ? $modelClass : null,
                    'model'       => $model,
                    'parentClass' => $this->config->get('fractal.abstract_parent',
                        'TransformerAbstract') ?: 'TransformerAbstract',
                ]);

            if ($create) {
                $this->filesystem->put("{$directory}/{$class}.php", $view->render());
                $this->info("The class {$class} generated successfully.");
            }
        } catch (\Exception $e) {
            $this->error("Transformer creation failed due to : {$e->getMessage()}");
        }
    }
992955
public function handle()
    {
        $bladePath = $this->laravel['config']['view.compiled'];
        $twigPath = $this->laravel['config']['view.twig'];

        if (! $bladePath || ! $twigPath) {
            throw new \RuntimeException('View cache path not found.');
        }

        foreach ($this->files->glob("{$bladePath}/*.php") as $view) {
            $this->files->delete($view);
        }

        $this->files->deleteDirectories($twigPath);

        $this->info('Compiled views cleared.');
    }
1039054
public function handle()
    {
        $destenationFile = $this->getDestinationFullname();

        if ($this->alreadyExists($destenationFile)) {
            $this->error('The resource-file already exists! To override the existing file, use --force option.');

            return false;
        }

        $parser = $this->getParser();
        $tableName = $this->getTableName();

        if (Config::autoManageResourceMapper()) {
            $mapper = new ResourceMapper($this);
            $mapper->append($this->getModelName(), $this->getNewFilename(), $tableName);
        }

        $this->createVirtualMigration($parser->getResource(), $destenationFile, $tableName);

        $this->createFile($destenationFile, $parser->getResourceAsJson())
            ->info('The "' . basename($destenationFile) . '" file was crafted successfully!');
    }
635532
public function handle()
	{
		$theme = strtolower($this->argument('name'));
		$new_theme = strtolower($this->argument('new-name'));

		$theme_path = $this->getPath($theme);
		$new_theme_path = $this->getPath($new_theme);

		if(!$this->files->isDirectory($theme_path)){
			return $this->error('Theme "'.$theme.'" does not exist.');
		}

		if($this->files->isDirectory($new_theme_path)){
			return $this->error('Theme "'.$new_theme.'" is already exists.');
		}

		$this->files->copyDirectory($theme_path, $new_theme_path);

		$this->info('Theme "'.$new_theme.'" has been created.');
	}
18422
public function handle()
    {
        $name = $this->argument('name');
        if (str_contains($name, '\\')) {
            $location = $this->filesystem->transformNamespaceToLocation($name);
            $filename = $this->filesystem->getFileName($name);

        }else {
            $location = 'app/Repositories';
            $filename = $name;
        }
        $model = strpos($filename, 'Repository') ? explode('Repository', $filename)[0] : $filename;

        if (file_exists($location . '/' . $filename . '.php')) {
            return $this->error('Repository already exists');
        }
        $this->filesystem->makeDirectory(base_path($location), 0755, true, true);

        if (config('artify.adr.enabled') && !is_dir(app_path('App/Domain/Contracts'))) {
            $contractLocation = app_path('App/Domain/Contracts/');
            $repositoryLocation = app_path('App/Domain/Repositories/');
            $this->filesystem->makeDirectory($contractLocation, 0755, true, true);
            $this->filesystem->makeDirectory($repositoryLocation, 0755, true, true);
            
        }
        if (!config('artify.adr.enabled') && !is_dir(app_path('Repositories/Contracts'))) {
            $contractLocation = app_path('Repositories/Contracts/');
            $repositoryLocation = app_path('Repositories/');
            $this->filesystem->makeDirectory($contractLocation, 0755, true, true);
        }
        if (isset($contractLocation) && !$this->filesystem->exists($contractLocation . 'RepositoryInterface.php')) {
            copy(artify_path('artifies/stubs/RepositoryInterface.stub'),  $contractLocation . 'RepositoryInterface.php');
        }

        if (isset($repositoryLocation) && !$this->filesystem->exists($repositoryLocation . 'Repository.php')) {
            copy(artify_path('artifies/stubs/Repository.stub'), $repositoryLocation . 'Repository.php');
        }
        $namespacedModel = config('artify.adr.enabled') ? $this->filesystem->getNamespaceFromLocation(substr($location, 0, strrpos($location, '/'))) . '\\Models\\' . $model : config('artify.models.namespace') . $model;
        if ($this->option('model')) {
            if (config('artify.adr.enabled')) {
                $this->call('make:model',[
                    'name' => $namespacedModel
                ]);
            }
        }
        if (config('artify.adr.enabled')) {
            $namespacedModel = $namespacedModel . ";\nuse App\\Domain\\Repositories\\Repository";
        }
        $defaultRepositoryContent = $this->filesystem->get(artify_path('artifies/stubs/DummyRepository.stub'));
        $runtimeRepositoryContent = str_replace(['DummyNamespace','DummyModelNamespace', 'DummyRepository', 'Dummy'], [ $this->filesystem->getNamespaceFromLocation($location), $namespacedModel, $filename , ucfirst($model)], $defaultRepositoryContent);
        $this->filesystem->put(artify_path('artifies/stubs/DummyRepository.stub'), $runtimeRepositoryContent);
        $this->filesystem->copy(artify_path('artifies/stubs/DummyRepository.stub'), $location . '/' . $filename . '.php');
        $this->filesystem->put(artify_path('artifies/stubs/DummyRepository.stub'), $defaultRepositoryContent);

        $this->info('Yeey! Repository created successfully');
    }
1085619
public function handle()
    {
        $seeders = [];
        $path = $this->argument('path');
        $files = [];

        if( $path ) {
            $files[] = base_path($path . 'src/database/seeds/HoneyCombDatabaseSeeder.php');
        } else {
            $files = $this->getSeederFiles();
        }

        foreach ( $files as $filePath ) {
            $seeders = array_merge($seeders, array_keys(AnnotationsParser::parsePhp(file_get_contents($filePath))));
        }

        foreach ( $seeders as $class ) {
            if( class_exists($class) ) {
                if( app()->environment() == 'production' ) {
                    $this->call('db:seed', ["--class" => $class, '--force' => true]);
                } else {
                    $this->call('db:seed', ["--class" => $class]);
                }
            }
        }

        if( app()->environment() == 'production' ) {
            $this->call('db:seed', ['--force' => true]);
        } else {
            $this->call('db:seed');
        }

    }
760429
public function handle()
    {
        $packageName = $this->argument('name');

        if ($this->option('confirm')) {
            if (!$this->confirm("Do you want to install the {$packageName} package template right now? [yes|no]",
                true)
            ) {
                $this->comment("Package installation aborted by user.");

                return self::INSTALL_FAIL;
            }
        }

        if ($this->templateStorageEngine->packageExists($packageName)) {
            if (!$this->confirm("The package {$packageName} is already installed. Would you like to update it instead? [yes|no]",
                false)
            ) {
                $this->comment("The package {$packageName} is already installed and will not be updated.");

                return self::INSTALL_SUCCESS;
            } else {
                $this->comment("Okay, we will update the {$packageName} package template. Give us a moment to get things ready...");
                $this->call('template:update', ['name' => $packageName]);

                return self::INSTALL_SUCCESS;
            }
        }

        $this->line("Installing {$packageName}. Sit back and relax for a minute, this can take a while.");
        $this->templateStorageEngine->addPackage($packageName);
        $this->info("{$packageName} installed.");
        return self::INSTALL_SUCCESS;
    }
1057228
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.');
            }

            return $this->rollback($slug);
        }

        foreach ($this->packages->all() as $package) {
            $this->comment('Rollback the last migration from Package: ' .$package['name']);

            $this->rollback($package['slug']);
        }
    }
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;
    }
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);
    }
1225643
public function handle()
    {
        $moduleNameSpace = $this->argument('moduleNameSpace');
        $moduleNameSpace = str_replace('/', '\\', camel_case($moduleNameSpace));
        $moduleNameSpace = str_replace('\module', '\Module', $moduleNameSpace);
        $moduleInstallerClass = $moduleNameSpace . '\\ModuleInstaller';
        if (class_exists($moduleInstallerClass)) {
            $installer = new $moduleInstallerClass;
        } else {
            $this->error($moduleInstallerClass . ' is not found.');
            return;
        }
        $installer->run();
        $this->info($moduleNameSpace . ' installation complete.');
    }
35990
public function handle()
    {
        switch ($format = $this->option('format')) {
            case 'cli':
                $descriptor = new CliDescriptor(new CliDumper);
                break;
            case 'html':
                $descriptor = new HtmlDescriptor(new HtmlDumper);
                break;
            default:
                throw new InvalidArgumentException(sprintf('Unsupported format "%s".', $format));
        }

        $io = new SymfonyStyle($this->input, $this->output);

        $errorIo = $io->getErrorStyle();
        $errorIo->title('Laravel Var Dump Server');

        $this->server->start();

        $errorIo->success(sprintf('Server listening on %s', $this->server->getHost()));
        $errorIo->comment('Quit the server with CONTROL-C.');

        $this->server->listen(function (Data $data, array $context, int $clientId) use ($descriptor, $io) {
            $descriptor->describe($io, $data, $context, $clientId);
        });
    }
1201638
public function handle()
    {
        $themeManager = ThemeManager::instance();
        $themeName = $this->argument('name');
        $themeExists = Theme::exists($themeName);

        if (!$themeExists) {
            $themeName = strtolower(str_replace('.', '-', $themeName));
            $themeExists = Theme::exists($themeName);
        }

        if (!$themeExists) {
            return $this->error(sprintf('The theme %s does not exist.', $themeName));
        }

        if (!$this->confirmToProceed(sprintf('This will DELETE theme "%s" from the filesystem and database.', $themeName))) {
            return;
        }

        try {
            $themeManager->deleteTheme($themeName);

            $this->info(sprintf('The theme %s has been deleted.', $themeName));
        }
        catch (Exception $ex) {
            $this->error($ex->getMessage());
        }
    }
925579
public function handle()
    {
	    $name = $this->argument('name');
	    $moduleName = $this->option('module');
	    
	    
	    if(empty($moduleName))
	        $moduleName = $this->ask('Please provide the name of the module');
	    
	    $dir = 'migrations';
	    $modulePath = Module::get($moduleName)->relativePath;
	    $source = $modulePath . DIRECTORY_SEPARATOR . $dir;
	    
	    if(!is_dir(base_path($source))) {
	    	mkdir(base_path($source), 0775, true);
	    }
	    
	    
	    $this->call('make:migration', [
	    	'name' => $name,
		    '--path' => $source,
		    '--table' => $this->option('table'),
		    '--create' => $this->option('create'),
	    ]);
    }