src/CrudGeneratorCommands.php
public function createlang($model) {
        $this->console->line("Preparing model attributes");
        $bar = $this->console->output->createProgressBar(5);
        $options = $this->console->options('path');
        if ($options['path'] != "") {
            $path = $options['path'];
        } else {
            $path = "lang/vendor/crudgenerator/" . config("app.locale");
        }
        $path = str_replace("//", "/", str_replace(["\\", " "], ["/", ""], $path));
        $filename = str_finish(strtolower($model), ".php");
        $bar->advance();
        $this->console->line("Loading config array for {$model}");
        $config = CrudGenerator::getConfig($model, false);
        $bar->advance();
        $this->console->info("Config loaded!");
        //$this->console->line(print_r($config, true));
        $bar->advance();
        $this->console->line("Saving Lang file for {$model} in {$path} with filename '{$filename}'");
        if (CrudGenerator::saveResource("sirgrimorum::templates.lang", false, resource_path($path), $filename, $config)) {
            $this->console->info("Model Lang file saved!");
        } else {
            $this->console->error("Something went wrong and the model lang file could not be saved");
        }
        $bar->advance();
        $confirm = $this->console->choice("Do you wisth to create a Lang File for the model in es?", ['yes', 'no'], 0);
        if ($confirm == 'yes') {
            $path = "lang/vendor/crudgenerator/es";
            $filename = str_finish(strtolower($model), ".php");
            $this->console->line("Saving Lang file for {$model} in {$path} with filename '{$filename}'");
            if (CrudGenerator::saveResource("sirgrimorum::templates.langes", false, resource_path($path), $filename, $config)) {
                $this->console->info("Model Lang file saved!");
                $bar->finish();
            } else {
                $this->console->error("Something went wrong and the model lang file could not be saved");
                $bar->finish();
            }
        }
        $bar->finish();
    }
public function createlang($model) {
        $this->console->line("Preparing model attributes");
        $bar = $this->console->output->createProgressBar(5);
        $options = $this->console->options('path');
        if ($options['path'] != "") {
            $path = $options['path'];
        } else {
            $path = "lang/vendor/crudgenerator/" . config("app.locale");
        }
        $path = str_replace("//", "/", str_replace(["\\", " "], ["/", ""], $path));
        $filename = str_finish(strtolower($model), ".php");
        $bar->advance();
        $this->console->line("Loading config array for {$model}");
        $config = CrudGenerator::getConfig($model, false);
        $bar->advance();
        $this->console->info("Config loaded!");
        //$this->console->line(print_r($config, true));
        $bar->advance();
        $this->console->line("Saving Lang file for {$model} in {$path} with filename '{$filename}'");
        if (CrudGenerator::saveResource("sirgrimorum::templates.lang", false, resource_path($path), $filename, $config)) {
            $this->console->info("Model Lang file saved!");
        } else {
            $this->console->error("Something went wrong and the model lang file could not be saved");
        }
        $bar->advance();
        $confirm = $this->console->choice("Do you wisth to create a Lang File for the model in es?", ['yes', 'no'], 0);
        if ($confirm == 'yes') {
            $path = "lang/vendor/crudgenerator/es";
            $filename = str_finish(strtolower($model), ".php");
            $this->console->line("Saving Lang file for {$model} in {$path} with filename '{$filename}'");
            if (CrudGenerator::saveResource("sirgrimorum::templates.langes", false, resource_path($path), $filename, $config)) {
                $this->console->info("Model Lang file saved!");
                $bar->finish();
            } else {
                $this->console->error("Something went wrong and the model lang file could not be saved");
                $bar->finish();
            }
        }
        $bar->finish();
    }
public function createlang ( $ model ) { $ this -> console -> line ( "Preparing model attributes" ) ; $ bar = $ this -> console -> output -> createProgressBar ( 5 ) ; $ options = $ this -> console -> options ( 'path' ) ; if ( $ options [ 'path' ] != "" ) { $ path = $ options [ 'path' ] ; } else { $ path = "lang/vendor/crudgenerator/" . config ( "app.locale" ) ; } $ path = str_replace ( "//" , "/" , str_replace ( [ "\\" , " " ] , [ "/" , "" ] , $ path ) ) ; $ filename = str_finish ( strtolower ( $ model ) , ".php" ) ; $ bar -> advance ( ) ; $ this -> console -> line ( "Loading config array for {$model}" ) ; $ config = CrudGenerator :: getConfig ( $ model , false ) ; $ bar -> advance ( ) ; $ this -> console -> info ( "Config loaded!" ) ; //$this->console->line(print_r($config, true)); $ bar -> advance ( ) ; $ this -> console -> line ( "Saving Lang file for {$model} in {$path} with filename '{$filename}'" ) ; if ( CrudGenerator :: saveResource ( "sirgrimorum::templates.lang" , false , resource_path ( $ path ) , $ filename , $ config ) ) { $ this -> console -> info ( "Model Lang file saved!" ) ; } else { $ this -> console -> error ( "Something went wrong and the model lang file could not be saved" ) ; } $ bar -> advance ( ) ; $ confirm = $ this -> console -> choice ( "Do you wisth to create a Lang File for the model in es?" , [ 'yes' , 'no' ] , 0 ) ; if ( $ confirm == 'yes' ) { $ path = "lang/vendor/crudgenerator/es" ; $ filename = str_finish ( strtolower ( $ model ) , ".php" ) ; $ this -> console -> line ( "Saving Lang file for {$model} in {$path} with filename '{$filename}'" ) ; if ( CrudGenerator :: saveResource ( "sirgrimorum::templates.langes" , false , resource_path ( $ path ) , $ filename , $ config ) ) { $ this -> console -> info ( "Model Lang file saved!" ) ; $ bar -> finish ( ) ; } else { $ this -> console -> error ( "Something went wrong and the model lang file could not be saved" ) ; $ bar -> finish ( ) ; } } $ bar -> finish ( ) ; }
Create a Model Lang file from config array
@param string $model the model name in lowercase
Create a Model Lang file from config array