/** * Run the Update * * @return mixed|void */ public function call() { $pheal = $this->setScope('char')->getPheal(); foreach ($this->api_info->characters as $character) { $result = $pheal->Notifications(['characterID' => $character->characterID]); foreach ($result->notifications as $notification) { NotificationsModel::firstOrCreate(['characterID' => $character->characterID, 'notificationID' => $notification->notificationID, 'typeID' => $notification->typeID, 'senderID' => $notification->senderID, 'senderName' => $notification->senderName, 'sentDate' => $notification->sentDate, 'read' => $notification->read]); } } return; }
/** * Return notifications for a character * * @param $character_id * @param int $chunk * * @return mixed */ public function getCharacterNotifications($character_id, $chunk = 50) { return Notifications::join('character_notifications_texts', 'character_notifications.notificationID', '=', 'character_notifications_texts.notificationID')->join('eve_notification_types', 'character_notifications.typeID', '=', 'eve_notification_types.id')->where('characterID', $character_id)->take($chunk)->orderBy('sentDate', 'desc')->get(); }