我在使用php artisan db:seed
时正在关注Code Forest的教程,我收到此错误:
PHP致命错误:第13行的/var/www/app/database/seeds/SentrySeeder.php中找不到“Sentry”类
这里是SentrySeeder.php:
<?php
use App\Models\User;
class SentrySeeder extends Seeder {
public function run()
{
DB::table('users')->delete();
DB::table('groups')->delete();
DB::table('users_groups')->delete();
Sentry::getUserProvider()->create(array(
'email' => 'admin@admin.com',
'password' => "admin",
'first_name' => 'John',
'last_name' => 'McClane',
'activated' => 1,
));
Sentry::getGroupProvider()->create(array(
'name' => 'Admin',
'permissions' => array('admin' => 1),
));
// Assign user permissions
$adminUser = Sentry::getUserProvider()->findByLogin('admin@admin.com');
$adminGroup = Sentry::getGroupProvider()->findByName('Admin');
$adminUser->addGroup($adminGroup);
}
}
Sentry已添加到提供商下的应用中 我错过了什么?
答案 0 :(得分:9)
您是否添加了Facade for Sentry?
添加
'Sentry' => 'Cartalyst\Sentry\Facades\Laravel\Sentry',
到config / app.php中的外观数组
答案 1 :(得分:1)
将'Cartalyst \ Sentry \ SentryServiceProvider'添加到app / config / app.php中的服务提供商列表
答案 2 :(得分:0)
我必须在app / config / app.php文件中添加:
1
'Sentry'=&gt; 'Cartalyst \哨兵\外墙\ Laravel \哨兵',
到:'aliases'=&gt;阵列(
和
2
Cartalyst \哨兵\ SentryServiceProvider,
到:'providers'=&gt;阵列(