webNeat/lumen-generators

[ErrorException] Undefined index: factory on php artisan wn:resources

KevinBeckers opened this issue · 6 comments

Hey,

I am getting a [ErrorException] Undefined index: factory on php artisan wn:resources generator.yml
I am using lumen 5.2.

Thanks

Hello,

Can you please share your generator.yml file to help me investigate the issue ?

Thanks for using these generators

The file is in pastebin:
Yaml

Thanks in advance

It seems to be a bug in the code. This will be fixed in the next release 2.0

when is next release planned / this bug fixed ?

here's how to fix it, update \vendor\wn\lumen-generators\src\Commands\ResourcesCommand.php
around line 109 with this:

protected function serializeField($field)
{
    $name = $field['name'];
    $schema = $this->convertArray(str_replace(':', '.', $field['schema']), ' ', ':');
    $rules = (isset($field['rules'])) ? trim($field['rules']) : '';
    if(isset($field['tags'])) {
        $tags = $this->convertArray($field['tags'], ' ', ',');
    } else {
        $tags = '';
    }

    $string = "{$name};{$schema};{$rules};{$tags}";

    if(isset($field['factory'])){
        $string .= ';' . $field['factory'];
    }

    return $string;
}