To generate / build model files for our existing database tables, first we have to install following package:
composer require "laracademy/generators" --dev
Once the above step gets complete, please run below command inside your project root directory:
php artisan generate:modelfromtable --schema="YOUR_DATABASE_NAME"

Just notice the above command, we are using "--schema", to tell this package, to generate models for this specific database. If you haven't supply that option, it will generate models for all the tables except mysql default databases like "information_schema" etc.,

You can find more options like generating model for specific table etc, in the following link:

Comments (0)
Leave a Comment

loader Posting your comment...