laracasts / Laravel-5-Generators-Extended

This package extends the core file generators that are included with Laravel 5
https://laracasts.com/lessons/faster-workflow-with-generators
MIT License
2.45k stars 348 forks source link

Pivot Table creation results in error: ErrorException : array_map() expects parameter 1 to be a valid callback, class 'Str' not found #195

Open JustinRijsdijk opened 3 years ago

JustinRijsdijk commented 3 years ago

What I did

run the command and add 2 table names

What I expected to happen

I expect the command to generate the pivot table

What happened

it resulted in the following error:


   ErrorException  : array_map() expects parameter 1 to be a valid callback, class 'Str' not found

  at D:\XXXXX\API\vendor\laracasts\generators\src\Commands\PivotMigrationMakeCommand.php:173
    169|      * @return array
    170|      */
    171|     protected function getSortedSingularTableNames()
    172|     {
  > 173|         $tables = array_map('Str::singular', $this->getTableNamesFromInput());
    174| 
    175|         sort($tables);
    176| 
    177|         return $tables;

  Exception trace:

  1   array_map("Str::singular")
      D:\XXXXX\API\vendor\laracasts\generators\src\Commands\PivotMigrationMakeCommand.php:173

  2   Laracasts\Generators\Commands\PivotMigrationMakeCommand::getSortedSingularTableNames()
      D:\XXXXX\API\vendor\laracasts\generators\src\Commands\PivotMigrationMakeCommand.php:150

  Please use the argument -v to see more details.

What I've already tried to fix it

I tried some debugging, but I didn't succeed...

YosefOberlander commented 3 years ago

Any update?

YosefOberlander commented 3 years ago

I found the solution and opened a pull request to fix it #196