We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
When you use seeders to populate your database in Laravel, you sometimes have the need to run these from your code (e.g. from a command-line utility of after a certain migration happened.
It turns out this is very easy to do:
<?php
$seeder = new UserSeeder();
$seeder->run();
If you want to run them from the command-line, you do:
php artisan db:seed --class=UserSeeder
If this post was enjoyable or useful for you, please share it! If you have comments, questions, or feedback, you can email my personal email. To get new posts, subscribe use the RSS feed.