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