Populating a database in a Laravel migration file

Don’t put the DB::insert() inside of the Schema::create(), because the create method has to finish making the table before you can insert stuff. Try this instead: public function up() { // Create the table Schema::create(‘users’, function($table){ $table->increments(‘id’); $table->string(’email’, 255); $table->string(‘password’, 64); $table->boolean(‘verified’); $table->string(‘token’, 255); $table->timestamps(); }); // Insert some stuff DB::table(‘users’)->insert( array( ’email’ => ‘name@domain.example’, … Read more