Skip to content

Commit

Permalink
Merge pull request #1 from DRogueRonin/master
Browse files Browse the repository at this point in the history
Laravel 5.6 compatibility and fix getLatestLogs
  • Loading branch information
aginev committed Jun 26, 2018
2 parents 0190f01 + 655b4cc commit 5804aa0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 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
6 changes: 5 additions & 1 deletion src/Models/UserLoginActivity.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

class UserLoginActivity extends Model
{
/**
* Removes the "updated_at" column
*/
const UPDATED_AT = null;

/**
* The database table used by the model.
Expand All @@ -27,7 +31,7 @@ class UserLoginActivity extends Model
*
* @var bool
*/
public $timestamps = false;
public $timestamps = true;

/**
* The attributes that should be mutated to dates.
Expand Down

0 comments on commit 5804aa0

Please sign in to comment.