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
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners