pwweb / artomator

Artomator: Custom commands making life easier for Laravel.
MIT License
4 stars 1 forks source link

Custom routes in json #42

Closed frankpde closed 3 years ago

frankpde commented 4 years ago

Creating new models etc. overwrites custom routes placed between the artomator tags in web.php. Therefore need to also adjust the json to not delete these custom routes by mistake.

Currently get/post/ etc not supported.

frankpde commented 4 years ago

Example:

Route::get('/print/{id}', 'AccreditationController@print')->name('print');
rabrowne85 commented 4 years ago

I've added a fix to the Artomator for the custom routes. Can you kindly test with your installation and custom routes? I suggest you copy your existing routes to a backup and then try adding the custom values to the json file.

frankpde commented 4 years ago

Partial success. In order to extend the general CRUD routes using php Route::resource() need to be defined before calling php Route::resource(). Despite having the custom routes defined ahead of the resources in the json file, they get placed after the resource. Additionally it would be good to have an artomator command that regenerates the routes from json

rabrowne85 commented 4 years ago

Okay, that should be fairly simple.

rabrowne85 commented 4 years ago

The ability to regenerate the routes is a bit of a hack. I'm not able to get it to work without having it require the Model name. As such you have to run it with php artisan artomator.scaffold:routes Temp and then type exit. Thoughts?