How to create Models in Laravel from tables already created in the Mysql database

0

Good morning guys, I have a question in Laravel, I had a database created in Mysql and used the Xethron / migrations-generator to create the migrations from the tables created in the database, but how can I generate the Models in the Laravel from the migrations that are created?

    
asked by anonymous 21.04.2018 / 16:50

1 answer

0

Daywison, I do not know if I understand.

You would like to create the models from a command that manages the models automatically or the doubt is how to create the models with the names of the already existing tables.

If this is the first option, you'll see a package that you can use link . If it is the second following option, it follows the code snippet:

 
namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class ProductPeople extends Model
{
    // Nome da tabela existente
    protected $table = 'fornecedores';

}

I think it's the first one, but I've put both options in case anyone needs it. ;)

I hope I have helped!

    
24.04.2018 / 01:06