Skip to content
This repository has been archived by the owner on Jul 16, 2023. It is now read-only.

Ardent + Laravel 4.1.28 User model doesn't update remember_token #199

Open
divdax opened this issue Apr 23, 2014 · 6 comments
Open

Ardent + Laravel 4.1.28 User model doesn't update remember_token #199

divdax opened this issue Apr 23, 2014 · 6 comments

Comments

@divdax
Copy link

divdax commented Apr 23, 2014

Hi,

i use the latest Laravel release with ardent.
My User model extends Ardent and have some basic rules.

In the latest version of Laravel there is a new column "remember_token" which not gets updated with Ardent, because Eloquent uses the models save() method to update the auth token.

How this can be fixed? Any ideas? :)

@divdax
Copy link
Author

divdax commented Apr 23, 2014

Here my workaround:

Insert

User::$rules = array();

before Auth::attempt() in the AuthController so Laravel can use the save() method to update the remember_token.

Cheers! :)

@lan0
Copy link

lan0 commented Apr 23, 2014

Hey, thanks for the quick & dirty fix, I happened to stumble upon it right after you posted it :)

I just wanted to note that you also should do that before Auth::logout(), otherwise the remember_me cookie will remain valid.

@divdax
Copy link
Author

divdax commented Apr 23, 2014

Thanks @lan0
updatingmycontroller

@caijiong
Copy link

But if SomeModel::rules contains an unique rule,whenever you use somemodel->save() to update the model,it will throw a exception.(Seem to be #86 just can fix it in someway.)
Must I use somemodel->UpdateUnique() to avoid it?

@Cysioland
Copy link

+1 this. Saved so much hair pulling.

@EricWVGG
Copy link

This is a terrible hack but it still works. Thank you.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants