-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't get sentinel to work with setModel at runtime (Extending Sentinel) #367
Comments
Hi Please let us know some more information so we can try to debug the issue a bit better:
|
Hello, cartalyst/sentinel: 2.0.* I run the call at the top of my routes file, i have also tried it in the AppServiceProvider with the same issue. The authenticate method works beautifully, if i So far its Thanks |
Thanks. I'll have a look as soon as possible. |
Thank you, keep me posted 👍 |
Any news on this yet? |
Hello You'll need to also define the model on the persistence repository: Sentinel::getPersistenceRepository()->setUsersModel('App\Client'); I've updated the wiki to mention this as well. |
I am attempting to use the setModel function in runtime in the latest version of Laravel like this:
Sentinel::getUserRepository()->setModel('App\Client');
Then call methods such as
Sentinel::getUser();
, However, i am finding that when i do this, its accessing the original 'users' table and not the clients table which is represented when i doSentinel::getUserRepository()
.Its like i can login when i use the setModel function, the authenticate works fine and accesses the clients table, but when i use
getUser()
orcheck()
even though it says the user repository isApp\Client
it doesn't work.I've posted a stackoverflow to show more on this:
https://stackoverflow.com/questions/44348872/laravel-sentinel-setmodel-accessing-the-wrong-table
The text was updated successfully, but these errors were encountered: