Search code examples
phpslimcartalyst-sentinel

Activation issue with Cartalyst Sentinel native with Slim Framework


I want to use Cartalyst-Sentinel natively with Slim framework (not Laravel). Sentinel object work correctly (I use Sentinel::register method without problem) but when I use Activation object (example with Activation::create()method), receive the follow error:

Call to a member function create() on a non-object in ...\vendor\illuminate\support\Facades\Facade.php on line 210

This is my code:

    $data = Sentinel::register($credentials);
    $user = Sentinel::findById($data['id']);
    $activation = Activation::create($user);

This is a part of my composer.json:

"require": {
    "slim/slim": "^2.6",
    "entomb/slim-json-api": "dev-master",
    "symfony/http-foundation": "^2.7",
    "swiftmailer/swiftmailer": "^5.4",
    "respect/validation": "^0.9.3",
    "cartalyst/sentinel": "^2.0",
    "illuminate/database": "^5.1",
    "illuminate/events": "^5.1"
},

thanks


Solution

  • This is because the Activation class provided with Sentinel is only supported by Laravel directly not the Native Laravel/Database library for some strange reason.

    Consider using Sentry instead if possible. It's also made by Cartalyst and it is essentially the same library with less features but seems to be overall less buggy and manages dependencies better than Sentinel. It also has more reliable documentation overall.

    EDIT: You can get the Activation Repository for Native by replacing...

    Activation:: with Sentinel::getActivationRepository()