Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Flex's avatar
Level 4

Not working php artisan db:seed?

create following seed files, UserTableSeeds.php

<?php

use Illuminate\Database\Seeder;
use App\User;

class UserTablesSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        User::create([
        'name' => 'Flex',
        'email' => '[email protected]',
        'password' => Hash::make('password'),
        'remember_token' => str_random(10),
        ]);
    }
}

DatabaseSeeder.php

<?php

use Illuminate\Database\Seeder;


class DatabaseSeeder extends Seeder
{
    /**
     * Seed the application's database.
     *
     * @return void
     */
    public function run()
    {
        // $this->call(UsersTableSeeder::class);
        Eloquent::unguard();
        $this->call('UserTableSeeder');
    }
}

and run following command, php artisan db:seed

but got following error in my cmd reflection exception class userstableseeder does not exist

how can fix this problem?

0 likes
2 replies
ftiersch's avatar

You can check your names :)

File: UserTableSeeds.php Class: UserTablesSeeder Call: UserTableSeeder

When you get them all aligned it should work :) If it doesn't - run composer dump-autoload

1 like
Vandan29's avatar
Vandan29
Best Answer
Level 4

Check your names

Your file name: UserTablesSeeder

You call: UserTableSeeder

You add s after Table

1 like

Please or to participate in this conversation.