How to create dummy data using factories in Laravel

1. Create project “laralel new dummydata” – I already did
2. Setup database in .env file – I already did
3. Generate PostFactory

Open PostFactory.php and add this code inside return:

4. Create PostsTableSeeder

Open PostsTableSeeder.php and add this code in run method:

5. Modify the default DatabaseSeeder, add PostsTableSeeder class to the run method.

6. Run seeders