public function index($eventType = false) { Auth::isAdminOrDie(App::$instance); if (!$eventType) { $logList = LogRecord::take($this->getQlimit(50))->skip($this->getQOffset())->orderBy($this->getQOrder(), $this->getQVector())->with("user")->get(); } else { $logList = LogRecord::where('event_type', $eventType)->take($this->getQlimit(50))->skip($this->getQOffset())->orderBy($this->getQOrder(), $this->getQVector())->with("user")->get(); } //define event type foreach ($logList as $log) { $log->humanized = new stdClass(); $log->humanized->event_type = $this->defineLogType($log->event_type); } $eventType = $this->defineLogType($eventType); $recordsCount = LogRecord::all()->count(); //pages $pages = RenderEngine::makePagination($recordsCount, $this->getQlimit(50), 'route'); $this->render("logs/index", compact('logList', 'pages', 'eventType')); }