/** * Run the Update */ public function call() { $result = $this->setScope('server')->getPheal()->ServerStatus(); if (StatusModel::orderBy('currentTime', 'desc')->value('currentTime') != $result->request_time) { StatusModel::create(['currentTime' => $result->request_time, 'serverOpen' => $result->serverOpen, 'onlinePlayers' => $result->onlinePlayers]); } return; }
/** * Get the last server status * * @return mixed */ public function getEveLastServerStatus() { return ServerStatus::orderBy('created_at', 'desc')->first(); }
/** * Get the data for the notification. */ protected function getData() : Collection { return ServerStatus::orderBy('currentTime', 'desc')->take(1)->get(); }
/** * @param int $limit * * @return mixed */ public function getEveServerStatuses(int $limit = 200) { return ServerStatus::orderBy('created_at', 'desc')->take($limit)->get(); }