laralib/l5scaffold

Error create views: Undefined variable: schemaArray

Closed this issue · 6 comments

I'm using laravel 5.2.x and an error occurred when creating views:

[ErrorException]
Undefined variable: schemaArray

Exception trace:
() at /var/www/html/blog/vendor/laralib/l5scaffold/src/Makes/MakeView.php:144
Illuminate\Foundation\Bootstrap\HandleExceptions->handleError() at /var/www/html/blog/vendor/laralib/l5scaffold/src/Makes/MakeView.php:144
Laralib\L5scaffold\Makes\MakeView->replaceSchemaIndex() at /var/www/html/blog/vendor/laralib/l5scaffold/src/Makes/MakeView.php:101
Laralib\L5scaffold\Makes\MakeView->compileViewStub() at /var/www/html/blog/vendor/laralib/l5scaffold/src/Makes/MakeView.php:61
Laralib\L5scaffold\Makes\MakeView->generateView() at /var/www/html/blog/vendor/laralib/l5scaffold/src/Makes/MakeView.php:37
Laralib\L5scaffold\Makes\MakeView->start() at /var/www/html/blog/vendor/laralib/l5scaffold/src/Makes/MakeView.php:32
Laralib\L5scaffold\Makes\MakeView->__construct() at /var/www/html/blog/vendor/laralib/l5scaffold/src/Commands/ScaffoldMakeCommand.php:181
Laralib\L5scaffold\Commands\ScaffoldMakeCommand->makeViews() at /var/www/html/blog/vendor/laralib/l5scaffold/src/Commands/ScaffoldMakeCommand.php:100
Laralib\L5scaffold\Commands\ScaffoldMakeCommand->fire() at n/a:n/a
call_user_func_array() at /var/www/html/blog/vendor/laravel/framework/src/Illuminate/Container/Container.php:507
Illuminate\Container\Container->call() at /var/www/html/blog/vendor/laravel/framework/src/Illuminate/Console/Command.php:169
Illuminate\Console\Command->execute() at /var/www/html/blog/vendor/symfony/console/Command/Command.php:256
Symfony\Component\Console\Command\Command->run() at /var/www/html/blog/vendor/laravel/framework/src/Illuminate/Console/Command.php:155
Illuminate\Console\Command->run() at /var/www/html/blog/vendor/symfony/console/Application.php:791
Symfony\Component\Console\Application->doRunCommand() at /var/www/html/blog/vendor/symfony/console/Application.php:186
Symfony\Component\Console\Application->doRun() at /var/www/html/blog/vendor/symfony/console/Application.php:117
Symfony\Component\Console\Application->run() at /var/www/html/blog/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:107
Illuminate\Foundation\Console\Kernel->handle() at /var/www/html/blog/artisan:36

Okay, I'm working on it

Hello
I'm having the same problem. Also using Laravel 5.2.
Everything is created (model, controller, migration, seed, error.blade.php and layout.blade.php) except the views.

FYI:
Originally I had an issue with "Error: Class Illuminate\Foundation\Composer does not exist".
I fixed this by changing "use Illuminate\Foundation\Composer;" to "use Illuminate\Support\Composer;" in ScaffoldMakeCommand.php
Maybe this has to do with the current issue.

By the way: Your commit 6752eb6 that was supposed to fix the "Error: Class Illuminate\Foundation\Composer" doesn't show any changes, only a comment.

Just another info:
The error "Undefined variable: schemaArray" occurred when running the make:scaffold command without any schema attributes, e.g. php artisan make:scaffold Tweet

Running the command with schema attributes worked perfectly, e.g. php artisan make:scaffold Tweet --schema="title:string:default('Tweet #1'), body:text"

Any error yet?

Everything works fine if I run the artisan command with schema attributes.
Maybe you could point out in the Readme.md that schema attributes are mandatory when creating views.
Other than that it's all good.

Hello @letschke ,
New version of lib remove the mandatory option --schema. Now you can generate scaffold without parameter.