public function login() { $this->MyAction = 'login'; $Page = intval($this->_GET['Page']); $Page = $Page ? $Page : 1; $MysqlWhere = "where AgentID={$_SESSION['AgentID']}"; //echo $MysqlWhere;exit; include 'Modules/class.LoginlogsModule.php'; $Loginlogs = new Loginlogs(); $Page = intval($this->_GET['Page']); $Page = $Page ? $Page : 1; $PageSize = 20; $ListsNum = $Loginlogs->GetListsNum($MysqlWhere); $Rscount = $ListsNum['Num']; if ($Rscount) { $this->Data = $Data; $Data['RecordCount'] = $Rscount; $Data['PageSize'] = $PageSize ? $PageSize : $Data['RecordCount']; $Data['PageCount'] = ceil($Data['RecordCount'] / $PageSize); $Data['Page'] = min($Page, $Data['PageCount']); $Offset = ($Page - 1) * $Data['PageSize']; if ($Page > $Data['PageCount']) { $Page = $Data['PageCount']; } $Data['Data'] = $Loginlogs->GetLists($MysqlWhere, $Offset, $Data['PageSize']); MultiPage($Data, 10); $this->Data = $Data; } }
public function getLastLoginTime() { $lastLogin = Loginlogs::query()->where('user_id = :user:'******'user' => $this->id])->orderBy('id DESC')->limit(2)->execute(); // dd($lastLogin[0]); if ($this->getDI()->get('session')->auth['id'] == $this->id) { return $lastLogin[1]->created_at->diffForHumans(); } else { return $lastLogin[0]->created_at->diffForHumans(); } }