Jestem całkowicie nowa w laravel i próbuję nauczyć się robić kilka podstawowych rzeczy, więc proszę o mnie ... Więc próbuję podstawowych php rzemieślników db: seed po migracji mojej bazy danych, ale utrzymuje powrocie błąd tytułową w cmd - [ReflectionException] Klasa „UserTableSeeder” nie istniejeKlasa "UserTableSeeder" nie istnieje - Laravel 5.0 [php artisan db: seed]
Czego próbowałem
- Zmień przestrzeń nazw „UserTableSeeder.php "Przestrzeń nazw plików" Baza danych \ nasiona; ' i "użyj bazy danych \ nasiona \ UserTableSeeder;" W 'DatabaseSeeder.php' file
Poniżej migracje
<?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');
}
}
Poniżej 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]']);
}
}
Poniżej 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');
}
}
pan spróbować zaimportować (UserTableSeeder) klasę? – heavymetal91