Laravel-5-Generators-Extended
Laravel-5-Generators-Extended copied to clipboard
Pivot Table creation results in error: ErrorException : array_map() expects parameter 1 to be a valid callback, class 'Str' not found
- 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...
Any update?
I found the solution and opened a pull request to fix it #196