嗨,我是 laravel 的新手,我设置了我的安装并添加了 voyager 包。现在当我尝试刷新我的数据库 CLI 时:php artisan migrate:refresh --seed
我收到此错误消息。
Migrated: 2018_01_24_120417_create_voucher_table
Migrating: 2018_01_29_094240_create_shop_table
Migrated: 2018_01_29_094240_create_shop_table
Migrating: 2018_01_30_085852_create_categorys_table
Migrated: 2018_01_30_085852_create_categorys_table
Seeding: UsersTableSeeder
In Builder.php line 412:
No query results for model [TCG\Voyager\Models\Role].
我在哪里可以找到详细的错误描述以及种子有什么问题?
<?php
use Illuminate\Database\Seeder;
use TCG\Voyager\Models\Role;
use TCG\Voyager\Models\User;
class UsersTableSeeder extends Seeder
{
/**
* Auto generated seed file.
*
* @return void
*/
public function run()
{
if (User::count() == 0) {
$role = Role::where('name', 'admin')->firstOrFail();
User::create([
'name' => 'Admin',
'email' => 'admin@admin.com',
'password' => bcrypt('password'),
'remember_token' => str_random(60),
'role_id' => $role->id,
]);
}
}
}
格拉西亚斯