Flex
110
2
Laravel

Not working php artisan db:seed?

Posted 1 month ago by Flex

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?

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.