Laravel Running a Seeder


Example

You may add your new Seeder to the DatabaseSeeder class.

    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $this->call(UserTableSeeder::class);
    }

To run a database seeder, use the Artisan command

php artisan db:seed

This will run the DatabaseSeeder class. You can also choose to use the --class= option to manually specify which seeder to run.

*Note, you may need to run composer dumpautoload if your Seeder class cannot be found. This typically happens if you manually create a seeder class instead of using the artisan command.