Difference between Model Factory and a DB Seeder

Database seeder is a number of data that populates tables.

For example:

factory(App\User::class, 50)->create(); 

As we can see here 50 users will be created by the seeder.

On the other hand, Model factories (instructions) is a convenient centralized place to define how your models should be populated with fake data.

 

  • 249
  • 308
  • By Bablu Ahmed
  • Posted 9 months ago