cartalyst / sentinel

A framework agnostic authentication & authorization system.
BSD 3-Clause "New" or "Revised" License
1.51k stars 238 forks source link

Class 'Activation' not found #537

Open Qrzysio opened 4 years ago

Qrzysio commented 4 years ago

Sentinel works well with Laravel, but it has some traps when it comes to the native implementation.

Let's try creating an activation.

$user = Sentinel::findById(1);
$activation = Activation::create($user);

The above throws Class 'Activation' not found error.

It seems to be undocumented and consumes quite a lot of time to solve the problem out. Thanks to the only one post on StackOverflow.om I've found the 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. You can get the Activation Repository for Native by replacing... Activation:: with Sentinel::getActivationRepository()

So the solution is:

$user = Sentinel::findById(1);
$activation = Sentinel::getActivationRepository();

Unfortunately, there is nothing about that in docs. Consider adding a bit more info about native implementation, please.