Execute the console command.

@return mixed
@throws \Illuminate\Contracts\Filesystem\FileNotFoundException
186302
public function handle()
    {
        $this->line('=== Check Laravel .env ===');

        if (! env('LARROCK VARS')) {
            $this->info('=== Add LARROCK vars ===');
            \File::append(base_path('.env'), "\n\nLARROCK VARS=PLACED");
        }

        if (! env('MAIL_TEMPLATE_ADDRESS')) {
            \File::append(base_path('.env'), "\nMAIL_TEMPLATE_ADDRESS='company address'");
            $this->info('MAIL_FROM_ADDRESS not found. Add "company address"');
        }

        if (! env('MAIL_TEMPLATE_PHONE')) {
            \File::append(base_path('.env'), "\nMAIL_TEMPLATE_PHONE='company phone'");
            $this->info('MAIL_TEMPLATE_PHONE not found. Add "company phone"');
        }

        if (! env('MAIL_TEMPLATE_MAIL')) {
            \File::append(base_path('.env'), "\nMAIL_TEMPLATE_MAIL=admin@larrock-cms.ru");
            $this->info('MAIL_TEMPLATE_MAIL not found. Add "admin@larrock-cms.ru"');
        }

        if (! env('MAIL_FROM_ADDRESS')) {
            \File::append(base_path('.env'), "\nMAIL_FROM_ADDRESS=admin@larrock-cms.ru");
            $this->info('MAIL_FROM_ADDRESS not found. Add "admin@larrock-cms.ru"');
        }

        if (! env('MAIL_TO_ADMIN')) {
            \File::append(base_path('.env'), "\nMAIL_TO_ADMIN=admin@larrock-cms.ru");
            $this->info('MAIL_TO_ADMIN not found. Add "admin@larrock-cms.ru"');
        }

        if (! env('MAIL_FROM_NAME')) {
            \File::append(base_path('.env'), "\nMAIL_FROM_NAME='LARROCK'");
            $this->info('MAIL_FROM_NAME not found. Add "LARROCK"');
        }

        if (! env('SITE_NAME')) {
            \File::append(base_path('.env'), "\nSITE_NAME='LARROCK'");
            $this->info('SITE_NAME not found. Add "LARROCK"');
        }

        if (env('MAIL_STOP', false) !== false) {
            \File::append(base_path('.env'), "\nMAIL_STOP=false");
            $this->info('MAIL_STOP not found. Add "false"');
        }

        $this->info('.env vars currently installed');
    }
69481
public function handle()
    {
        $model = $this->getAttachableModelInstanceForClass($this->argument('class'));

        $attachmentKeys = $this->getAttachmentsToProcess($model);

        if (empty($attachmentKeys)) {
            $this->warn('No attachments selected or available for this model, nothing to process.');
            return;
        }

        $query = $this->getModelInstanceQuery($model);
        $count = $query->count();

        $this->progressStart($count);
        
        foreach ($this->generateModelInstances($query, $count) as $instances) {
            /** @var \Illuminate\Support\Collection|Model[]|AttachableInterface[] $instances */
            foreach ($instances as $instance) {

                foreach ($instance->getAttachedFiles() as $attachmentKey => $attachment) {

                    if ( ! in_array($attachmentKey, $attachmentKeys)) {
                        continue;
                    }

                    $this->processAttachmentOnModelInstance($instance, $attachment);
                }

                $this->progressAdvance();
            }
        }

        $this->progressFinish();

        $this->info('Done.');
    }
872642
public function handle() {
        \File::copy(__DIR__ . '/../environment/config/filesystems.php', base_path('config/filesystems.php'));
        \Config::set('filesystems.default', 'it');

        $plugin = $this->argument('plugin');
        if (in_array($plugin, $this->plugins)) {
            if ($plugin == 'merge') {
                $this->info('It' . $this->beer . ' preparing file system merge');
                $this->merge();
            } else if ($plugin == 'laravelcollective') {
                $this->laravelcollective();
            } else if ($plugin == 'yajra') {
                $this->yajra();
            } else if ($plugin == 'intervention') {
                $this->intervention();
            }
        } else {
            $plugg = [];

            $this->error('It' . $this->beer . ' Whoops please choose - plugin from list');
            $headers = [
                'Command (php artisan it:install)',
                'Description',
            ];
            foreach ($this->plugins as $plug) {
                if ($plug == 'merge') {
                    $title = 'A Controller File Project to merge your files';
                } elseif ($plug == 'payment') {
                    $title = 'Payment Getway trusted Packages Paypal,Cashu,payfort & much more ... ';
                } elseif ($plug == 'editors') {
                    $title = 'Ckeditor,NiceEdit,jWYSIWYG,summernote,react-rte & much more ...  ';
                } elseif ($plug == 'baboon') {
                    $title = 'Baboon CRUD System (MVC-SD) Created By Mahmoud Ibrahim v1';
                } elseif ($plug == 'laravelcollective') {
                    $title = 'Install Laravel Collective Package (laravelcollective.com) ';
                } elseif ($plug == 'yajra') {
                    $title = 'Install yajra datatable Package (yajrabox.com) ';
                } elseif ($plug == 'intervention') {
                    $title = 'Install intervention Image Package (image.intervention.io) ';
                }
                array_push($plugg, [$plug, $title]);
            }
            $this->table($headers, $plugg);
        }
    }
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);
        }
    }
582614
public function handle()
    {
        $app = app();
        $this->version = (int) str_replace('.', '', $app->version());

        // check if module exists
        if ($this->files->exists(app_path().'/Modules/'.studly_case($this->getNameInput()))) {
            return $this->error($this->type.' already exists!');
        }

        // Create Controller
        $this->generate('controller');

        // Create Model
        $this->generate('model');

        // Create Views folder
        $this->generate('view');

        //Flag for no translation
        if (! $this->option('no-translation')) { // Create Translations folder
            $this->generate('translation');
        }

        if ($this->version < 530) {

            // Create Routes file
            $this->generate('routes');
        } else {

            // Create WEB Routes file
            $this->generate('web');
            
            // Create API Routes file
            $this->generate('api');
        }
        
        // Create Helper file
        $this->generate('helper');



        if (! $this->option('no-migration')) {

            // without hacky studly_case function
            // foo-bar results in foo-bar and not in foo_bar
            $table = str_plural(snake_case(studly_case($this->getNameInput())));
            $this->call('make:migration', ['name' => "create_{$table}_table", '--create' => $table]);
        }

        $this->info($this->type.' created successfully.');
    }
1133668
public function handle()
    {
        $exists = false;

        if (File::exists($this->publishedMigrationRealpath())) {
            $exists = true;

            if (!$this->confirm('The migration file already exists, overwrite it? [Yes|no]')) {
                return $this->info('Okay, no changes made to the file.');
            }
        }

        $inputFile = file_get_contents($this->localMigrationRealpath());

        $outputFile = fopen($this->publishedMigrationRealpath(), 'w');

        if ($inputFile && $outputFile) {
            fwrite($outputFile, $inputFile);

            fclose($outputFile);
        } else {
            File::delete($this->publishedMigrationRealpath());

            return $this->error(
                        'There was an error creating the migration file, '
                        .'check write permissions for ' . base_path('database') . DIRECTORY_SEPARATOR . 'migrations'
                        .PHP_EOL
                        .PHP_EOL
                        .'If you think this is a bug, please submit a bug report '
                        .'at https://github.com/moharrum/laravel-geoip-world-cities/issues'
                    );
        }

        if(! $exists) {
            $this->info('Okay, migration file created successfully.');

            return;
        }

        $this->info('Okay, migration file overwritten successfully.');
    }
987211
public function handle()
    {
        // If the package is already installed, abort installation
        if ($this->packageIsInstalled()) {
            return $this->abortInstallation();
        }

        $this->startProgressBar();

        $this->addConfigArrays();
        $this->saveOriginalRouteServiceProvider();
        $this->replaceRouteServiceProvider();
        $this->addLanguageMiddleware();
        $this->registerLanguageMiddleware();

        $this->stopProgressBar();
    }
1145887
public function handle()
    {
        $config = $this->container['config'];

        // Get the Language codes.
        $languages = array_keys(
            $config->get('languages', array())
        );

        if ($this->option('path')) {
            $path = $this->option('path');

            if (! $this->files->isDirectory($path)) {
                return $this->error('Not a directory: "' .$path .'"');
            } else if (! $this->files->isDirectory($path .DS .'Language')) {
                return $this->error('Not a translatable path: "' .$path .'"');
            }

            return $this->updateLanguageFiles($path, $languages);
        }

        // Was not specified a custom directory.
        else {
            $paths = $this->scanWorkPaths($config);
        }

        // Update the Language files in the available Domains.
        foreach ($paths as $path) {
            if (! $this->files->isDirectory($path)) {
                continue;
            } else if (! $this->files->isDirectory($path .DS .'Language')) {
                $this->comment('Not a translatable path: "' .$path .'"');

                continue;
            }

            $this->updateLanguageFiles($path, $languages);
        }
    }
1369638
public function handle()
    {


        $this->info('Getting directory list');

        // Bare respoitories
        $directory = rtrim(trim($this->argument('directory')), '/') . '/';
        $scanned_directory = array_diff(scandir($directory), array('..', '.'));
        $this->info('Found ' . count($scanned_directory) . ' directories');

        $progresbar = $this->output->createProgressBar(count($scanned_directory));
        $progresbar->setFormat(' %current%/%max% [%bar%] %percent:3s%% %message% ');
        $progresbar->setMessage('Searching...');

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

        $inspector = new Inspector($this->settings);

        foreach($scanned_directory as $path){
            $this->logVerbose('Inpecting: ' . $path);


            if(null !== $this->option('only') && strcmp($path, $this->option('only')) !== 0){
                $progresbar->advance();
                continue;
            }

            if(null !== $this->option('skippast') && strcmp($path, $this->option('skippast')) <= 0){
                $progresbar->advance();
                continue;
            }

            $repository = $inspector->getRepositoryByPath($directory . $path);


            // Check modified date
            if(null !== $this->option('modified')){
                $modifiedTimestamp = strtotime($this->option('modified'));

                /**
                 * @var $date \DateTime
                 */
                try {
                    $this->logVerbose('Getting commit date');
                    $commitDate = $repository->getHeadCommit()->getCommitterDate();
                } catch(\Gitonomy\Git\Exception\ReferenceNotFoundException $e){
                    $this->error($e->getMessage());
                    $this->error('Error finding reference for ' . $path);
                }

                if($modifiedTimestamp === false || $commitDate->getTimestamp() < $modifiedTimestamp){
                    $progresbar->advance();
                    continue;
                }
                $this->logVerbose('Don\'t skip');
            }


            $repository->setLogger(new ConsoleLogger($this->getOutput()));

            $this->logVerbose('Searching git');

            $resultSet = $inspector->inspectRepository($repository);
            $remote = $resultSet['remote'];

            $this->logVerbose('Found remote ' . $remote);

            if(count($resultSet['results']) > 0){
                $progresbar->setMessage('Found ' . count($resultSet['results']) . ' tests for ' . $remote);
            }
            if(!$this->option('dry-run')) {
                foreach ($resultSet['results'] as $result) {
                    $insert = $result->toArray();
                    $insert['remote'] = $remote;
                    $insert['author_slug'] = Str::slug($result->getAuthor());
                    $insert['created_at'] = Carbon::createFromTimestamp($result->getDate());

                    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));
                    }
                }
            }
            $progresbar->advance();


        }

        Artisan::call('got:normalize-names');
    }
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);
    }
378925
public function handle()
    {
        $this->tables = $this->getTablesFromMWBFile();
        if ($this->tables === false) {
            return false;
        }
        $this->getAppJson();

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

        $tableName = $this->option('table');
        if (!empty($tableName)) {
            $table = $this->findTableFromName($tableName);
            if (empty($table)) {
                $this->output('Table ( '.$tableName.' ) doesn\'t exist.', 'error');

                return false;
            }
            $this->tables = [$table];
        }

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

        $this->generateMigration();
        $this->generateModel();

        $this->styleCode();

        $this->databaseService->dropDatabase();

        return true;
    }
55119
public function handle()
    {
        $this->_initVersions();
        $this->info("Running public asset file update:\n");

        $assets = $this->input->getArgument('assets');
        $forceAssets = [];
        if ($this->input->getOption('default-themes') && !array_key_exists(Assets\Themes::$name, $assets)) {
            $assets[] = Assets\Themes::$name;
            $forceAssets[] = Assets\Themes::$name;
        }
        $updateAssets = $assets ? array_intersect_key($this->_assetNames, array_fill_keys($assets, null)) : $this->_assetNames;

        $bar = $this->output->createProgressBar(count($updateAssets));
        $bar->setFormatDefinition('custom', ' %current%/%max% [%bar%] -- %message% %details%');
        $bar->setFormat('custom');
        $bar->setMessage('', 'details');
        $bar->setMessage('Initializing ...');
        $bar->display();

        $errors = [];
        $reportMessages = [];
        foreach ($updateAssets as $assetName => $assetClass) {
            $bar->setMessage('Updating: ' . ($assetClass::$description ?: $assetName) . ' (' . $assetClass::$version . ')');
            $bar->display();
            $options = $this->input->getOptions();
            $options['force'] = in_array($assetName, $forceAssets) ? true : $options['force'];
            /** @var Assets\AbstractAsset $asset */
            $asset = new $assetClass($this->_folders['public'], $this->_assetInstalledVersions[$assetName], $options, $bar);
            try {
                $this->_setVersion($assetName, $asset->execute());
                $reportMessages[$assetName] = $asset->getReport();
            } catch (\Exception $e) {
                if ($e->getMessage()) {
                    $errors[$assetName] = $e->getMessage() . ' [' . $e->getFile() . ':' . $e->getLine() . ']';
                }
            }
            $bar->advance();
        }

        $bar->setMessage('', 'details');
        $bar->setMessage('Finished' . ($errors ? ' with errors' : ''));
        $bar->finish();
        $this->info("\n");
        if ($errors) {
            foreach ($errors as $assetName => $error) {
                $this->error($assetName . ': ' . $error);
            }
        }
        foreach ($reportMessages as $assetName => $assetReport) {
            foreach ($assetReport as $reportMessage) {
                $this->comment($assetName . ': ' . $reportMessage);
            }
        }

        // if in console and not installed, display notice
        if (app()->runningInConsole() && !Install::isComplete()) {
            $this->comment('To complete Coaster installation visit /install in your web browser .');
        }
    }
1363596
public function handle()
    {
        $path = config('stubs.path');
        $this->createDirectory($path);
        $publishedCount = 0;

        foreach ($this->stubs as $stub) {
            $from = base_path($this->frameworkPath . $stub);
            $to = $path . '/' . basename($stub);
            $publishedCount += (int)$this->publishFile($from, $to);
        }

        foreach ($this->migrationStubs as $stub => $name) {
            $from = base_path($this->frameworkPath . $stub);
            $to = $path . '/' . $name;
            $publishedCount += (int)$this->publishFile($from, $to);
        }

        if ($publishedCount === 0) {
            $this->line('Nothing to publish');
        }
    }
132346
public function handle()
    {
        $filename = $this->option('filename');
        $this->write = $this->option('write');
        $this->dirs = array_merge(
            $this->laravel['config']->get('ide-helper.model_locations'),
            $this->option('dir')
        );
        $model = $this->argument('model');
        $ignore = $this->option('ignore');
        $this->reset = $this->option('reset');
        if ($this->option('smart-reset')) {
            $this->keep_text = $this->reset = true;
        }
        $this->write_model_magic_where = $this->laravel['config']->get('ide-helper.write_model_magic_where', true);

        //If filename is default and Write is not specified, ask what to do
        if (!$this->write && $filename === $this->filename && !$this->option('nowrite')) {
            if ($this->confirm(
                "Do you want to overwrite the existing model files? Choose no to write to $filename instead?"
            )
            ) {
                $this->write = true;
            }
        }

        $content = $this->generateDocs($model, $ignore);

        if (!$this->write) {
            $written = $this->files->put($filename, $content);
            if ($written !== false) {
                $this->info("Model information was written to $filename");
            } else {
                $this->error("Failed to write model information to $filename");
            }
        }
    }
12692
public function handle()
    {
        $filesystem = new Filesystem;
        $filesystem->copyDirectory(
            __DIR__ . '/stubs/install',
            base_path()
        );
        $this->call('storage:link');

        if ($this->option('migrate')) {
            $this->call('migrate', ['--path' => str_replace(base_path(), '', __DIR__) . '/../../migrations']);
            $this->call('db:seed', ['--class' => \Kaiwh\Admin\Seeds\InitAdminSeeder::class]);
        }
    }
673680
public function handle()
    {
        $model = $this->argument('model');

        if ($this->filesystem->exists(app_path("/Http/Controllers/{$model}Controller.php")))
            return $this->error("Controller already exists");

        if (!$this->filesystem->exists(app_path($model.'.php'))) {
            $this->call('make:model', ['name' => $model]);
        }

        if (!$this->filesystem->exists(app_path('/Http/Requests/'.$model.'StoreRequestForm.php'))) {
            $this->call('make:request', ['name' => "{$model}StoreRequestForm"]);
        }

        if (!$this->filesystem->exists(app_path('/Http/Requests/'.$model.'UpdateRequestForm.php'))) {
            $this->call('make:request', ['name' => "{$model}UpdateRequestForm"]);
        }

        $defaultControllerContent = $this->filesystem->get(artify_path('artifies/stubs/DummyController.stub'));

        if ($this->option('repository')) {
            $this->call('artify:repository', ['name' => "{$model}Repository"]);
            $runtimeControllerContent = str_replace(['$dummy->delete();','$dummy->update(request()->all());','Dummy::latest()','Dummy::create(request()->all());'],['\DummyRepository::delete($dummy->id);','\DummyRepository::update($dummy->id, request()->all());','\DummyRepository::latest()','\DummyRepository::create(request()->all());'],$defaultControllerContent);
        }

        if (!$this->filesystem->exists(app_path('/Http/Controllers/'.$model.'Controller.php'))) {
            if (!config('artify.cache.enabled')) {
                    $layerName = strpos($runtimeControllerContent ?? $defaultControllerContent, '\DummyRepository') ? '\DummyRepository' : 'Dummy';
                    if($this->option('repository')){
                        $assignedLayer = '$dummies = \\' . $model .'Repostiroy::latest()->get();';

                    }
                    $runtimeControllerContent = str_replace(["cache()->forget('dummies');\n", "cache('dummies')",'cache()->remember(\'dummies\', config(\'artify.cache.duration\'), function () {
            $dummies = ' . $layerName . '::latest()->get();
        });'], ['', '$dummies', $assignedLayer ?? '$dummies = Dummy::latest()->get();'], $runtimeControllerContent ?? $defaultControllerContent);
            }

            $runtimeControllerContent = str_replace(
                ['dummy', 'Dummy', 'dummies'],
                [strtolower($model), ucfirst($model), strtolower(str_plural($model))],
                $runtimeControllerContent ?? $defaultControllerContent
            );

            $this->filesystem->put(artify_path('artifies/stubs/DummyController.stub'), $runtimeControllerContent);
            $this->filesystem->copy(artify_path('artifies/stubs/DummyController.stub'), app_path('/Http/Controllers/'.$model.'Controller.php'));
            $this->filesystem->put(artify_path('artifies/stubs/DummyController.stub'), $defaultControllerContent);
            $this->filesystem->append(base_path('routes/web.php'), "\nRoute::resource('" . strtolower($model) . "', '{$model}Controller');");
            $this->info("{$model} crud created successfully");
        }
    }
510608
public function handle()
    {
        $generator = FileGenerator::make($this->getRootDirectory(), $this->getStubDirectory());

        if ($this->generate($generator) === false) {
            return false;
        }

        $this->info($this->type.' created successfully.');
    }