adspace
How do I seed my database for column that is a foreign key referencing to other table?
Answer Posted / Mohd Shahnawaz Qureshi
To seed a database with data for a foreign key column, you can use the factory method on the related model and call it within your seeder class's run() method. Make sure to set the relationship before saving the instance.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers