Skip to content

Commit

Permalink
Make getLatest really get the chronologically latest entries
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Weipert committed Feb 27, 2018
1 parent ed442fa commit 655b4cc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Handlers/EloquentHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function getLogs() {
* @return mixed
*/
public function getLatestLogs($limit = null) {
return UserLoginActivity::take($this->setLimit($limit))->get();
return UserLoginActivity::latest()->take($this->setLimit($limit))->get();
}


Expand All @@ -87,7 +87,7 @@ public function getLoginLogs() {
* @return mixed
*/
public function getLatestLoginLogs($limit = null) {
return UserLoginActivity::where('event', '=', 'login')->take($this->setLimit($limit))->get();
return UserLoginActivity::latest()->where('event', '=', 'login')->take($this->setLimit($limit))->get();
}

/**
Expand All @@ -106,7 +106,7 @@ public function getLogoutLogs() {
* @return mixed
*/
public function getLatestLogoutLogs($limit = null) {
return UserLoginActivity::where('event', '=', 'logout')->take($this->setLimit($limit))->get();
return UserLoginActivity::latest()->where('event', '=', 'logout')->take($this->setLimit($limit))->get();
}

/**
Expand Down

0 comments on commit 655b4cc

Please sign in to comment.