search

Home  >  Q&A  >  body text

php - Encountering problems with related tables when filling data using Laravel 5.4 fzaninotto/Faker, how to fill the data?

1. There are existing tables raceinfo and groupinfo. The field race_id of table groupinfo is associated with the primary key of table raceinfo.
2. When using fzaninotto/Faker to fill data into table groupinfo, data filling failure will occur.
Question: How to solve the problem of foreign key association between two related tables and successfully fill in false data?

巴扎黑巴扎黑2792 days ago535

reply all(1)I'll reply

  • 迷茫

    迷茫2017-05-16 13:16:54

    Just turn off the foreign key constraints before starting to fill in the data.
    It doesn’t matter if the filling is completed or not. Closing constraints is only valid for the current database connection.

    http://laravelacademy.org/pos...

    reply
    0
  • Cancelreply