Closed noxeone closed 4 years ago
@noxeone can you let me know what command you are running and what model name and fields you are giving?
Thanks for the answer!
Model Goods was created from schema file, with command:
php artisan infyom:api_scaffold Goods --fieldsFile=JSON/Goods.json
These lines appear in the file ViewServiceProvider.php after creation relation with another database table from schema file SaleGoods.json:
{ "name": "goods_id", "dbType": "integer:unsigned:foreign,goods,goods_id", "htmlType": "selectTable:goods:name,goods_id", "relation": "mt1,goods,goods_id,goods_id", "validations": "", "searchable": false, "fillable": true, "primary": false, "inForm": true, "inIndex": true, "inView": true },
In a neighboring Issue, I answered in more detail: https://github.com/InfyOmLabs/laravel-generator/issues/851
@noxeone you can pass model name in htmlType.
like this: "htmlType": "selectTable:goods,Goods:name,goods_id",
When the model name ends in "S", sometimes there may be problems: In the file ViewServiceProvider.php created a line
use App\Models\Good;
Without "S"! And in the same file the model call looks like:$goodItems = Good::pluck('name','goods_id')->toArray();
Good without "S".