laravel-api-generator icon indicating copy to clipboard operation
laravel-api-generator copied to clipboard

Do you have a --prefix="prefix' option?

Open phillipmadsen opened this issue 9 years ago • 3 comments

like the one pingpong generator has?

If not how hard would it be to add it or create it?

phillipmadsen avatar Sep 02 '15 00:09 phillipmadsen

@phillipmadsen we have a routes templates. so you can publish these templates and can modify them to add a prefix in your way. You can add prefix to all api routes by adding prefix to api_rotues group in routes.php. or for scaffold we have a template file scaffold_routes.stub. so you can modify it and can add prefix to that.

But I like the idea of passing it via command. so will take it in a queue.

mitulgolakiya avatar Sep 02 '15 03:09 mitulgolakiya

Great please let me know when it becomes a part of it.

phillipmadsen avatar Sep 02 '15 15:09 phillipmadsen

OK I have adjusted the scaffold_routes.stub with a test of "admin" and the routes adjust but nothing else. In pingpongs when you prefix the crud is prefixed not just the routes.

Pingpong Example: php artisan generate:scaffold task --fields="name:string, description:text" --prefix=admin When this is run it creates all the crud files in Admin/cruds so the routes match up. To do this in yours like I have done in my personal version I had to manually add it to almost every file in your generator. I will create a repo and share it with you but its just a rough work in progress but you will see all the things I had to change in order to get it to work.

If you prefix it like pingpong I can get the same outcome by running it like this and not having to rewrite all the files.

php artisan phillips:crud User --fieldsFile="/home/vagrant/sites/2local/resources/assets/fields/user.json" --softDelete php artisan phillips:crud User --fieldsFile="/home/vagrant/sites/2local/resources/assets/fields/user.json" --softDelete --prefix="admin"

php artisan phillips:crud Category --fieldsFile="/home/vagrant/sites/2local/resources/assets/fields/category.json" --softDelete php artisan phillips:crud Category --fieldsFile="/home/vagrant/sites/2local/resources/assets/fields/category.json" --softDelete --prefix="admin"

here is a link to what I have been working on. If you go through it you will see I have had to change almost every file to get it where it is now.

https://github.com/phillipmadsen/laravel-api-generator.git

phillipmadsen avatar Sep 02 '15 16:09 phillipmadsen