Jason Spick
Jason Spick

Reputation: 6098

Laravel 4 seeding class Sentry not found

I'm following a tutorial from Code Forest an when using php artisan db:seed, I get this error:

PHP Fatal Error: Class 'Sentry' not found in /var/www/app/database/seeds/SentrySeeder.php on line 13

here is 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'       => '[email protected]',
        '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('[email protected]');
    $adminGroup = Sentry::getGroupProvider()->findByName('Admin');
    $adminUser->addGroup($adminGroup);
    }

}

And here is User model

Sentry has been added to apps under providers What Am i missing?

Upvotes: 2

Views: 4960

Answers (3)

3xCh1_23
3xCh1_23

Reputation: 1499

I had to add both in app/config/app.php file:

1.

'Sentry' => 'Cartalyst\Sentry\Facades\Laravel\Sentry',

to the: 'aliases' => array(

AND

2.

Cartalyst\Sentry\SentryServiceProvider,

to the: 'providers' => array(

Upvotes: 0

Partoo
Partoo

Reputation: 11

Add 'Cartalyst\Sentry\SentryServiceProvider' to the list of service providers in app/config/app.php

Upvotes: 1

Alexander Cogneau
Alexander Cogneau

Reputation: 1274

Have you added the Facade for Sentry?

add

'Sentry' => 'Cartalyst\Sentry\Facades\Laravel\Sentry',

to the array of facades in config/app.php

Upvotes: 10

Related Questions