我正在尝试播种用户表但我收到以下错误: [ReflectionException] 类UsersTableSeeder不存在
我不知道出了什么问题,我和其他桌子和播种机多次这样做过。
这是我的迁移
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',
]);
}
}
...
感谢您的帮助。
答案 0 :(得分:2)
请运行composer dump-autoload
再试一次