php artisan db:Laravel5的种子不起作用

时间:2015-07-10 10:00:32

标签: php database laravel-5

php artisan db:当我尝试使用它时,Laravel5的种子无效。我的 DatabaseSeeder.php 类如下

    <?php

use App\User;
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
use DB;

class DatabaseSeeder extends Seeder 
{
    public function run()
    {
        $this->call('UserTableSeeder');

        $this->command->info('User table seeded!');
    }
}



class UserTableSeeder extends Seeder
{
  public function run()
  {
    DB::table('users')->delete();

    User::create(array(
        'name'     => 'Rakesh',
        'username' => 'Rakesh',
        'email'    => 'sharmarakesh395@gmail.com',
        'password' => Hash::make('mypass'),
    ));
  }
}

我正在尝试运行php artisan db:seed。但它没有用。谢谢

0 个答案:

没有答案