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

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners