InfyOmLabs / laravel-generator

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

[Bug]: If model has 2 words in the name PhpDoc and route paths are generated different. #836

Closed aydinbulut closed 2 years ago

aydinbulut commented 4 years ago

My JSON file is UserRole.json

I did run php artisan infyom:api_scaffold --fieldsFile=UserRole.json UserRole

routes/api.php Route::resource('user_roles', 'UserRoleAPIController');

routes/web.php Route::resource('userRoles', 'UserRoleController');

The first difference is different route paths for API and WEB. Hence, API endpoints don't match the generated paths.

image

If I fix the route in routes/api.php then UpdateUserRoleRequest fails since I am using a unique attribute in my model. Below line is generated code but it fails because $this->route("user_role") doesn't match any route.

$rules['slug'] = $rules['slug'].",".$this->route("user_role");

Am I missing something about naming in the documentation?

Also, I tried like below and still the same. php artisan infyom:api_scaffold --fieldsFile=User_Role.json User_Role

ruanpepe commented 4 years ago

Same error from #793

mitulgolakiya commented 2 years ago

Fixed.