-
-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Query] Is there a way to generate all resources from an existing database? #120
Comments
It’s been a while since I used it, but please try The mapped-resources command is designed to allow you to create multiple resources all specified at once. If you created resources using this package, most likely you already have This command could be improved in the future to allow you to generate resource for every table on a given database. But in most cases, you’ll never want a CRUD for every table which is why the mapped-resource command allow you to only add what you really need. You may also want to review the documentation on how to correctly modify the map file https://crestapps.com/laravel-code-generator/docs/2.2 The documentation has two related sections, once talks about the command and the second talk about the file’s format and what commands available there I hope this helps. PS: kindly use stackoverflow.com for question where github is for bugs or new future requests. |
@skills-up this is what I've used. First, run
This will create all the necessary resource files and you can carry on from there. NB: You can run the above code within Tinker. |
@CrestApps what do you think about the approach I suggested here #120 (comment) ? I can submit a PR to add it as an option to the package. |
@dbilovd the problem with that approach is I suggest creating a new command called That code in the Then in the MySqlParser you'll implement the If you do that, please submit a PR request. |
@dbilovd you can even make the getModelName($tableName) public and then call |
Hi,
Is there a way to generate all the resources from an existing database?
I know we can generate resources pertaining to individual tables using:
php artisan resource-file:from-database [model-name]
What I wish to know is if there is any command like:
php artisan resource-file:from-database --all-tables
to generate resources for all the tables in the database with a single command?
This will be really helpful for generating one click demos/applications from a schema, without the need to write a separate script to iterate through the database, and generating corresponding commands in the shell.
Thanks,
Gaurav
The text was updated successfully, but these errors were encountered: