Setup : Create your laravel app and connect to database composer create-project laravel/laravel laravel_api open.env and configure database DB_HOST=127.0.0.1 DB_DATABASE=laravel_api DB_USERNAME=root DB_PASSWORD= Generate the tables using: php artisan migrate Now let's open the app ang navigate to the folders, you will see in app/database/factories that laravel have already created a sample factory for us using table users
To run the seeder let's paste it first inside the DatabaseSeeder.php in the same folder $this->call(TodoSeeder::class); Go to terminal and run that specific seeder: php artisan db:seed --class=TodoSeeder
To run all the Database seeders inside it use this: php artisan db:seed