Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 this issue May 1, 2021 · 2 comments

Comments

@JustinRijsdijk
Copy link

JustinRijsdijk commented May 1, 2021

  • Laravel Version: 6.20.26
  • PHP Version: 7.3.21
  • Laravel-5-Generators-Extended Version: 2.0
  • Command: php artisan make:migration:pivot departments users

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
Copy link

Any update?

@YosefOberlander
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants