jeffochoa / voyager-bread-generator

Create BREAD from the console using artisan
MIT License
54 stars 28 forks source link

Call to undefined function VoyagerBread\Commands\studly_case() #11

Open loooping-old opened 4 years ago

loooping-old commented 4 years ago

I need create migration and seeder for my bread, when I run:

bash-5.0# php artisan voyager:bread my_bread --migration

I have this error

Making BREAD

   Symfony\Component\Debug\Exception\FatalThrowableError  : Call to undefined function VoyagerBread\Commands\studly_case()

  at /var/www/html/vendor/voyager-bread-generator/src/Commands/BreadGenerator.php:104
    100|      * @return string
    101|      */
    102|     protected function getNameInput()
    103|     {
  > 104|         return trim(studly_case($this->argument('name')));
    105|     }
    106| 
    107|     /**
    108|      * Create a migration file for the model.

  Exception trace:

  1   VoyagerBread\Commands\BreadGenerator::getNameInput()
      /var/www/html/vendor/laravel/framework/src/Illuminate/Console/GeneratorCommand.php:54

  2   Illuminate\Console\GeneratorCommand::handle()
      /var/www/html/vendor/voyager-bread-generator/src/Commands/BreadGenerator.php:35

  Please use the argument -v to see more details.
hasnains commented 4 years ago

I have temporary fixed it:

Replace studly_case() with Str::studly at line no 104 and 129 of file vendor\voyager-bread-generator\src\Commands\BreadGenerator.php

Before:

protected function getNameInput()
    {
        return trim(studly_case($this->argument('name')));
    }

protected function createModel()
    {
        $table = studly_case($this->argument('name'));
        $this->call('make:model', [
            'name' => $table
        ]);
    }

Now:

protected function getNameInput()
    {
        return trim(Str::studly($this->argument('name')));
    }

protected function createModel()
    {
        $table = Str::studly($this->argument('name'));
        $this->call('make:model', [
            'name' => $table
        ]);
    }
loooping-old commented 4 years ago

Thank you