Im brand new to laravel and im trying to learn to do a few basic things, so please tell me. So I try to use the basic php artisan db: seed after migrating my database, but it continues to return a header error in cmd - [ReflectionException] Class "UserTableSeeder" does not exist
Things i tried
- Change the namespace in the namespace UserTableSeeder.php 'Database \ seed;' and 'use database \ seed \ UserTableSeeder;' in the file "DatabaseSeeder.php"
Migration Listed Below
<?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateUsersTable extends Migration { 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(); }); } public function down() { Schema::drop('users'); } }
Below is UserTableSeeder.php
<?php use App\User; use Illuminate\Database\Seeder; class UserTableSeeder extends Seeder { public function run() { DB::table('users')->delete(); User::create(['email' => ' foo@bar.com ']); } }
Below is DatabaseSeeder.php
<?php use Illuminate\Database\Seeder; use Illuminate\Database\Eloquent\Model; class DatabaseSeeder extends Seeder { public function run() { Model::unguard(); $this->call('UserTableSeeder'); } }
source share