2015-06-29 64 views
0

我試圖種子用戶表,但我得到以下錯誤: [ReflectionException] 類UsersTableSeeder不存在Laravel:播種錯誤

我不知道什麼是錯的,我做了很多次其他桌子和播種機。

這裏是我的移民

use Illuminate\Database\Schema\Blueprint; 
use Illuminate\Database\Migrations\Migration; 

class CreateUsersTable extends Migration { 

    /** 
    * Run the migrations. 
    * 
    * @return void 
    */ 
    public function up() 
    { 
     Schema::create('users', function(Blueprint $table) { 
      $table->increments('id'); 
      $table->string('name'); 
      $table->string('surname'); 
      $table->string('initials'); 
      $table->string('email')->unique(); 
      $table->string('password', 60); 
      $table->rememberToken(); 
      $table->timestamps(); 
     }); 
    } 

    ... 

DatabaseSeeder.php

... 
$this->call('UsersTableSeeder'); 
... 

UsersTableSeeder.php

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

use Faker\Factory as Faker; 

class UsersTableSeeder extends Seeder { 
    public function run() { 
     $faker = Faker::create(); 

     User::create([ 
      'name'  => 'Some name', 
      'surname' => 'Some surname', 
      'initials' => 'SI', 
      'email' => 'Some email', 
      'password' => 'Some password', 
     ]); 
    } 
} 

... 

謝謝你的幫助。

+1

請運行'composer dump-autoload'並嘗試再次播種 – Digitlimit

回答

2

請運行composer dump-autoload並再試一次