czim / laravel-repository

Repository pattern implementation for Laravel
MIT License
51 stars 19 forks source link

exception: Call to undefined function Czim\Repository\Console\Commands\str_singular() #23

Open mysic opened 2 years ago

mysic commented 2 years ago

hello when I ran the command "php artisan make:repository SomethingRepository" ,and catched the exception info.

my env is : Laravel Framework 6.20.44 czim/laravel-repository 2.0.2

  at /xxx/vendor/czim/laravel-repository/src/Console/Commands/MakeRepositoryCommand.php:159                                                                                                 
    155| 
    156|             $repositoryClass = str_replace($this->getNamespace($name) . '\\', '', $name);
    157|             $class           = str_replace($this->suffix, '', $repositoryClass);
    158| 
  >159|             $modelClass = str_singular($class);
    160|         }
    161| 
    162|         // Append the expected models namespace if not namespaced yet
    163|         if (false === strpos($modelClass, '\\')) {

it's better to change the str_singular($class) to Str::singular($class)

czim commented 2 years ago

I don't really support this legacy package anymore. Your best bet it is to upgrade so you can use package version 3.0.0. If you want to submit a PR for an older version, that is welcome too of course.