Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

As soon, I am typing php artisan db:seed command.

I'm getting Error Like:

[ReflectionException]
Class UserTableSeeder does not exist

root@dd-desktop:/opt/lampp/htdocs/dd/laravel# php artisan db:seed

Here, Is my UserTableSeeder.php & DatabaseSeeder.php Page

UserTableSeeder.php

<?php
use IlluminateDatabaseSeeder;
use IlluminateDatabaseEloquentModel;

class UserTableSeeder extends Seeder
{    
    public function run()
    {
        DB::table('users')->delete();
        User::create(array(
        'name'     => 'Chris Sevilleja',
        'username' => 'sevilayha',
        'email'    => 'chris@scotch.io',
        'password' => Hash::make('awesome'),
        ));
    }    
}

DatabaseSeeder.php

<?php

use IlluminateDatabaseSeeder;
use IlluminateDatabaseEloquentModel;

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

I'm Referring This Link To Design & Develop Login Page. Please Help me to resolve this issue. Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
415 views
Welcome To Ask or Share your Answers For Others

1 Answer

Perform a composer update, then composer dump-autoload.

If the above doesn't solve the problem, change the classmap in your composer.json file such that it contains the project-relative path to your php files:

"autoload-dev": {
    "classmap": [
        "tests/TestCase.php",
        "database/seeds/UserTableSeeder.php" //include the file with its path here
    ]
}, /** ... */

and soon after, perform a composer dump-autoload, and it should work now like a breeze!

Edit by @JMSamudio

If composer dump-autoload is not found, just enable this option composer config -g -- disable-tls true.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...