laravel - Storing remember_token to a separate table than users? -
is possible set table & column store remember tokens? know framework tries automatically find remember_token
column in "users" model, want store separately users. there way configure default tokens table? thank you
p.s - i'm using laravel 5
first, need create separate model storing remember tokens , define relationship on user model so
public function remembertoken() { return $this->hasone('remembertoken'); }
then need override methods on user model, defined in authenticatable
trait. override getremembertoken()
, setremembertoken()
methods. need override getremembertokenname()
used in where
clause in eloquentuserprovider::retrievebytoken()
see eloquentuserprovider line 60. in order work have add global scope user model join remember_tokens
table on every query, , return 'remember_tokens.token'
getremembertokenname()
method.
think twice seems more trouble worth. why want store tokens separately anyway?
Comments
Post a Comment