modules = [ 'LOGIN' => 'Login', 'USERMANAGEMENT' => 'User Management', 'MEMBERMANAGEMENT' => 'Member Management', 'PROMOTIONS' => 'Promotions', 'TOPUP' => 'Top-Up', 'CARDTYPES' => 'Card Types', 'REPORT_TOPUP' => 'Report - Top Up', 'REPORT_STATIONRATINGS' => 'Report - Station Ratings', 'REPORT_MOBILEUSAGE' => 'Report - Mobile Usage', 'REPORT_REGISTRATION' => 'Report - Registration', 'SYSTEMPREFERENCES' => 'System Preferences', 'STATION' => 'Station', 'PHOTOSLIDER' => 'Photo Slider', 'NOTIFICATION' => 'Notification' ]; $this->actions = [ 'STORE' => 'store', 'UPDATE' => 'update', 'DELETE' => 'delete', 'ACTIVATE' => 'activate', 'GENERATE' => 'generate', 'EXPORT' => 'export', 'LOGIN' => 'login', 'LOGOUT' => 'logout', ]; } public function getByField($field,$value) { $this->adminActionLogs = AdminActionLogs::where($field,$value) ->orderBy('created_dt','desc'); return $this->adminActionLogs->get(); } public function log($id, $module, $action, $remarks = '') { if(isset($this->modules[$module]) && isset($this->actions[$action])) { $currentUser = CurrentUserHelper::get_currentAdmin(); $this->adminActionLogs = new AdminActionLogs; $this->adminActionLogs->id = $id; $this->adminActionLogs->module = $this->modules[$module]; $this->adminActionLogs->action = $this->actions[$action]; $this->adminActionLogs->created_by = isset( $currentUser ) ? $currentUser->admin_id : $id; if($remarks != '') $this->adminActionLogs->remarks = $remarks; if ($this->adminActionLogs->save()) { return true; } } return false; } }