コード例 #1
0
ファイル: Bookmarks.php プロジェクト: eveseat/eveapi
 /**
  * Run the Update
  *
  * @return mixed|void
  */
 public function call()
 {
     $pheal = $this->setScope('char')->getPheal();
     foreach ($this->api_info->characters as $character) {
         $result = $pheal->Bookmarks(['characterID' => $character->characterID]);
         // Process each folder and the bookmarks therein
         foreach ($result->folders as $folder) {
             // Currently a denormalized table is used for both
             // the folder information as well as the bookmarks
             // themselves.
             foreach ($folder->bookmarks as $bookmark) {
                 $location_info = $this->find_nearest_celestial($bookmark->locationID, $bookmark->x, $bookmark->y, $bookmark->z);
                 $bookmark_info = Bookmark::firstOrNew(['characterID' => $character->characterID, 'folderID' => $folder->folderID, 'bookmarkID' => $bookmark->bookmarkID]);
                 $bookmark_info->fill(['folderName' => $folder->folderName, 'creatorID' => $bookmark->creatorID, 'created' => $bookmark->created, 'itemID' => $bookmark->itemID, 'typeID' => $bookmark->typeID, 'locationID' => $bookmark->locationID, 'x' => $bookmark->x, 'y' => $bookmark->y, 'z' => $bookmark->z, 'mapID' => $location_info['mapID'], 'mapName' => $location_info['mapName'], 'memo' => $bookmark->memo, 'note' => $bookmark->note]);
                 $bookmark_info->save();
             }
             // Foreach Bookmark
             // Cleanup old bookmarks in this folder
             Bookmark::where('characterID', $character->characterID)->where('folderID', $folder->folderID)->whereNotIn('bookmarkID', array_map(function ($bookmark) {
                 return $bookmark->bookmarkID;
             }, (array) $folder->bookmarks))->delete();
         }
         // Foreach Folder
         // Cleanup old folders
         Bookmark::where('characterID', $character->characterID)->whereNotIn('folderID', array_map(function ($folder) {
             return $folder->folderID;
         }, (array) $result->folders))->delete();
     }
     return;
 }
コード例 #2
0
 /**
  * Return a characters Bookmarks
  *
  * @param $character_id
  *
  * @return mixed
  */
 public function getCharacterBookmarks($character_id)
 {
     return Bookmark::where('characterID', $character_id)->get();
 }
コード例 #3
0
ファイル: Bookmarks.php プロジェクト: eveseat/services
 /**
  * Return a characters Bookmarks
  *
  * @param int $character_id
  *
  * @return \Illuminate\Support\Collection
  */
 public function getCharacterBookmarks(int $character_id) : Collection
 {
     return Bookmark::where('characterID', $character_id)->get();
 }