Execute the console command.

@param \Jumilla\Addomnipot\Laravel\Addons\AddonGenerator $generator

@return mixed
488106
public function handle(Filesystem $filesystem, AddonEnvironment $env, AddonGenerator $generator)
    {
        $addon_name = preg_replace('#(/+)#', '-', $this->argument('name'));

        // Check addon-directory
        if ($env->exists($addon_name)) {
            throw new UnexpectedValueException("addon directory '{$addon_name}' is already exists.");
        }

        $output_path = $env->spacePath($this->option('space'), $addon_name);

        // Adjust addon_name
        $addon_name = preg_replace('/[^\w_\-]/', '', $addon_name);

        $addon_class = preg_replace(
            ['/[^\w_]/', '/^(\d)/'],
            ['', '_$1'],
            studly_case($addon_name)
        );

        // namespace
        if ($this->option('no-namespace')) {
            $namespace = '';
        } else {
            if ($this->option('namespace')) {
                $namespace = str_replace('/', '\\', $this->option('namespace'));
            } else {
                $namespace = 'App\\'.$addon_class;
            }

            if (! $this->validPhpNamespace($namespace)) {
                throw new UnexpectedValueException("PHP namespace '{$namespace}' is invalid.");
            }
        }

        // languages
        $languages = $this->option('language') ? explode($this->option('language')) : [];

        // Show select prompt if not specified
        $skeleton = $this->chooseSkeleton($this->argument('skeleton'));

        $properties = [
            'addon_name' => $addon_name,
            'addon_class' => $addon_class,
            'namespace' => $namespace,
            'languages' => array_unique(array_merge(['en', $this->laravel['config']->get('app.locale')], $languages)),
            'test_namespace' => 'Tests\\'.studly_case($addon_name),
        ];

        // confirm
        $this->line('Addon name: '.$properties['addon_name']);
        $this->line('PHP namespace: '.$properties['namespace']);
        $this->line('Skeleton: '.$skeleton);
        $this->line('Languages: '.implode(', ', $properties['languages']));

        if (!$this->option('yes') && !$this->confirm('generate ready? [Y/n]', true)) {
            $this->comment('canceled');
            return;
        }

        try {
            $generator->generateAddon($output_path, str_replace(':', '-', $skeleton), $properties);
            $this->info('Addon Generated.');
        } catch (Exception $ex) {
            $filesystem->deleteDirectory($output_path);

            throw $ex;
        }
    }
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');
    }
544506
public function fire()
    {
        $instance  = $this->argument('instance');
        $template  = $this->option('template');
        $force     = $this->option('force');
        $merge     = $this->option('merge');
        $namespace = config('admin-generator.namespace');
        $engine    = config("admin-generator.instances.{$instance}.engine");

        if ( ! $namespace) {
            $this->error("The config 'namespace' in 'config/admin-generator.php' can not be empty, general set it to 'console'");
            exit;
        }

        if ( ! config("admin-generator.instances.{$instance}")) {
            $this->warn("The instance '{$instance}' is not exist, check the typo or add it to config/admin-generator.php first");
            exit;
        }

        if ( ! $engine) {
            $this->warn("The engine of instance '{$instance}' is not exist, check the typo or add it to config/admin-generator.php first");
        }

        $templates = $this->getTemplates($template, $merge, $engine);

        $files = $this->getMergedFiles($templates, $engine);

        $filesystem = new Filesystem();

        foreach ($files as $src) {
            $destName = $this->getFileDest($src, $engine);

            $destName = $this->replaceKeyword($destName);

            if (is_file($destName) && ! $force) {
                $this->error(sprintf("The file %s is already exist, use option '--force' to override it", str_replace(base_path() . '/', '', $destName)));
                exit;
            } else {
                $this->info(sprintf("Copying file to %s", str_replace(base_path() . '/', '', $destName)));
            }

            $content  = $filesystem->get($src);
            $replaced = $this->replaceKeyword($content);

            $filesystem->put($destName, $replaced);
        }

        $this->warn('Done! Please config route and menu in app.coffee and MenuController.coffee');
    }
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}");
    }
698142
public function fire()
    {
        $generator = new ControllerGenerator([
            'name' => $this->argument('name'),
            'resource' => $this->option('resource'),
            'scaffold' => $this->option('scaffold'),
            'force' => $this->option('force'),
        ]);

        $generator->run();

        $this->info('Controller created successfully.');
    }
1029142
public function handle()
    {
        $this->normalizeGeneratorFilter();
        $starterClass = $this->normalizeStarterClass($this->argument('modelStarterClass'));
        $this->isForce = $this->option('force');

        if (!$starterClass) {
            $this->error("Please use scaffold:model Class\To\ModelStarter");
        } elseif (!class_exists($starterClass)) {
            $this->error($starterClass . " doesn't exist");
        } elseif (!$this->isModelStarter($starterClass)) {
            $this->error($starterClass . " is not a ModelStarter");
        } else {
            $this->igniteStarter($starterClass);
        }
    }
108502
public function build(Generator $generator)
    {
        $renderer = new DOMRenderer($generator, $this);
        $publisher = new Publisher($generator, $this);

        $pageManager = $this->loadPageManager($generator);
        while (!$pageManager->getQueue()->isEmpty()) {
            $page = $pageManager->getQueue()->dequeue();

            if ($pageManager->hasPage($page)) {
                continue;
            }

            // Parse the source file:
            $sourceFile = $pageManager->getSourceFile($page);

            // Register the page:
            $pageManager->addPage($page, $sourceFile);

            // Parse the content:
            $content = $renderer->renderContentElement($sourceFile->getContent());

            // And add the content to the publisher:
            $publisher->add($page, $content);
        }

        $publisher->publish();
    }
970452
public function fire()
    {
        if (! class_exists($model = $this->argument('model')))
        {
            throw new \InvalidArgumentException('Model does not exist!');
        }

        $this->generator->make(
            $model,
            $this->option('method'),
            $this->option('html')
        );
    }
397688
public function fire()
    {
        $path = $this->getPath();
        $template = $this->option('template');

        $this->printResult($this->generator->make($path, $template), $path);
    }
1264748
public function handle(ConfigurationProvider $provider, Migrator $migrator)
    {
        if (!$this->confirmToProceed()) {
            return;
        }

        $configuration = $provider->getForConnection(
            $this->option('connection')
        );

        $version   = $this->argument('version');
        $direction = $this->option('down') ? 'down' : 'up';

        $version = $configuration->getVersion($version);

        if ($path = $this->option('write-sql')) {
            $migrator->executeToFile($version, $direction, $path);
        } else {
            $migrator->execute($version, $direction, $this->option('dry-run'), $this->option('query-time'));
        }

        foreach ($migrator->getNotes() as $note) {
            $this->line($note);
        }
    }
1003583
public function generator(Generator $generator, $status = 200, array $headers = [])
    {
        return $this->create(new Iteratorstream($generator), $status, $headers);
    }
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');
        }

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

        $migrator->makeLogTable();

        $this->doRefresh($migrator);

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

        if ($seed) {
            $this->call('database:seed', ['name' => $seed, '--force' => true]);
        }
    }
585846
public function handle()
    {
        if (!$this->modelExists()) {
            $this->error('Model does not exists !');

            return false;
        }

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

        if ($stub and !is_file($stub)) {
            $this->error('The stub file dose not exist.');

            return false;
        }

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

        $this->generator = new ResourceGenerator($modelName);

        if ($this->option('output')) {
            return $this->output($modelName);
        }

        parent::handle();
    }
1183366
public function handle()
    {
        $this->initDatabase();

        $this->initAdminDirectory();

        $this->call('vendor:publish', ['--provider' => \Lia\Addons\JWTAuth\Providers\JWTAuthServiceProvider::class]);
        $this->call('jwt:generate');
    }
161981
public function handle()
    {
        $manager = new UserManager();

        $repository = $manager->getRepository();

        foreach ($repository->findAllToRefreshToken((bool) $this->option('force')) as $user) {
            $token = $repository->generateToken();
            $result = $manager->update($user, ['token' => $token]);

            if ($result->ok()) {
                $this->info(sprintf('Updated user #%s with token %s', $user->id, $token));
            } else {
                $this->error(sprintf('Error while updating user #%s with token %s', $user->id, $token));

                if (!$this->option('ignoreErrors')) {
                    return;
                }
            }
        }
    }
1165526
public function fire()
    {
        $filePathToGenerate = $this->getFileGenerationPath();

        try
        {
            $this->generator->make(
                $this->getTemplatePath(),
                $this->getTemplateData(),
                $filePathToGenerate
            );

            $this->info("Created: {$filePathToGenerate}");
        }

        catch (FileAlreadyExists $e)
        {
            $this->error("The file, {$filePathToGenerate}, already exists! I don't want to overwrite it.");
        }
    }