InfyOmLabs / laravel-generator

API and Admin Panel CRUD Generator for Laravel.
https://www.infyom.com/open-source
MIT License
3.79k stars 812 forks source link

Bug when generating an scaffod #881

Closed cfmorales closed 4 years ago

cfmorales commented 4 years ago

Theres a bug after trying to generate an scaffoling

php artisan infyom:scaffold test5 --datatables=true
Specify fields for the model (skip id & timestamp fields, we will add it automatically)
Read docs carefully to specify field inputs)
Enter "exit" to finish

 Field: (name db_type html_type options) []:
 > name string text

 Enter validations:  []:
 >

 Field: (name db_type html_type options) []:
 > exit

Migration created:
2020_08_05_194436_create_test5s_table.php

Model created:
test5.php

Repository created:
test5Repository.php

Create Request created:
Createtest5Request.php

Update Request created:
Updatetest5Request.php

   ErrorException  : Undefined property: InfyOm\Generator\Common\GeneratorField::$isOrderable

  at C:\laragon\www\test\vendor\smarirabah\laravel-generator\src\Common\GeneratorField.php:151
    147|         if ($key == 'fieldTitle') {
    148|             return Str::title(str_replace('_', ' ', $this->name));
    149|         }
    150|
  > 151|         return $this->$key;
    152|     }
    153| }
    154|

  Exception trace:

  1   Illuminate\Foundation\Bootstrap\HandleExceptions::handleError("Undefined property: InfyOm\Generator\Common\GeneratorField::$isOrderable", "C:\laragon\www\test\vendor\smarirabah\laravel-generator\src\Common\GeneratorField.php", ["isOrderable"])
      C:\laragon\www\test\vendor\smarirabah\laravel-generator\src\Common\GeneratorField.php:151

  2   InfyOm\Generator\Common\GeneratorField::__get("isOrderable")
      C:\laragon\www\test\vendor\smarirabah\laravel-generator\src\helpers.php:180

  Please use the argument -v to see more details.`

php version 7.2.33 "laravel/framework": "5.6.*",

mitulgolakiya commented 4 years ago

@cfmorales we will check it. But soon we are going to deprecate (or no longer giving fixes) to all the versions below 6.x.

Since last 6 is an LTS, 7 is already released months ago and Laravel 8 is also announced to be released in September.

I will also check if the same bug is there in 6.x and 7.x.

mitulgolakiya commented 4 years ago

@cfmorales I've just checked it with the latest version of Laravel that we support. I will say you try to reproduce this issue with Laravel 6.0 or great and report us with more inputs.

I tried to generate with your same input and I'm able to run it successfully.

image

Also, it looks like isOrderable is not from Laravel Generator, it's from DataTables. so, I do not see any possible fix right now for this.

Check with the latest version and if you still find a bug then re-open this issue with more inputs.