I have a mysql database with some tables in it , is there anyway to create models and controllers for this database using larvael framework ? I mean the fast way to do it , any command ... Thank you for helping me , any suggestion will be hellpfull , thank you .
Asked
Active
Viewed 231 times
0
-
You can make models and controllers using `artisan` command. However, when you would want to migrate your code to production, you would need database migration files as well. So, for that, you will need `createIfNotExists()`(or similar method) instead of `create()` for your database migration. – nice_dev Mar 21 '19 at 14:06
-
You answers are here https://laravel.com/docs/5.8/eloquent – Azael Mar 21 '19 at 14:11
2 Answers
1
I don't know of such a plugin (if you can call it like that) that provides such functionality.
The fastest way to achieve what you are looking for (without a plugin) would be to go at every table and create the model using php artisan make:model <ModelName> -a
. This would create the model, the migrations, the controller and the factory.
Another alternative was to loop through all the tables and make make a script to run the command above related to the model/table

Bruno Francisco
- 3,841
- 4
- 31
- 61
0
The question is a little vague. Laravel ships with a tool called Artisan, this is PHP cli tool to help with the development of your application. You can access this by running the following command
php artisan
Artisan has a whole lot of stuff, that it can do and create.

James Hudson
- 51
- 8