Imはlaravelに全く新しいものです。いくつかの基本的なことを学びたいので、私と一緒に裸にしてください。 DB:シード私のデータベースを移行した後、それはCMDのタイトルエラーを返す保つ - [ReflectionException]クラスのUserTableSeederは「クラス 'UserTableSeeder'は存在しません - Laravel 5.0 [php artisan db:seed]
物事を存在していない私は
- 変更] UserTableSeeder.phpの名前空間を試みがあります'File'名前空間Database \ seeds; 'と 'データベース\シース\ UserTableSeederを使用する'; 'DatabaseSeeder.php' ファイルに以下
は移行以下
<?php
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('email')->unique();
$table->string('password', 60);
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('users');
}
}
あるUserTableSeeder.php以下
<?php
use App\User;
use Illuminate\Database\Seeder;
class UserTableSeeder extends Seeder {
public function run()
{
DB::table('users')->delete();
User::create(['email' => '[email protected]']);
}
}
あるDatabaseSeeder.php
<?php
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
class DatabaseSeeder extends Seeder {
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
$this->call('UserTableSeeder');
}
}
を実行してみてください、あなたはこの(UserTableSeeder)クラスをインポートしようとしたのですか? – heavymetal91