"See" a user on the initial page load too

This commit is contained in:
Toby Zerner 2015-03-30 12:55:39 +10:30
parent 8e3186d41c
commit 6e6f4a6fdf
3 changed files with 10 additions and 2 deletions

View File

@ -23,8 +23,7 @@ class LoginWithHeader
($accessToken = AccessToken::where('id', $token)->first())) {
$this->actor->setUser($user = $accessToken->user);
$user->last_seen_time = time();
$user->save();
$user->updateLastSeen()->save();
}
return $next($request);

View File

@ -404,6 +404,13 @@ class User extends Model
return $this;
}
public function updateLastSeen()
{
$this->last_seen_time = time();
return $this;
}
/**
* Check whether or not the user is an administrator.
*

View File

@ -19,6 +19,8 @@ class LoginWithCookie
if (($token = $request->cookie('flarum_remember')) &&
($accessToken = AccessToken::where('id', $token)->first())) {
$this->actor->setUser($accessToken->user);
$user->updateLastSeen()->save();
}
return $next($request);