Exemple #1
0
 public function toArray()
 {
     $array = parent::toArray();
     $array['url'] = $this->getUrl();
     $array['thumbUrl'] = $this->getThumbUrl();
     return $array;
 }
 public function toArray()
 {
     $array = parent::toArray();
     $array['user'] = $this->getUser();
     $array['task'] = $this->getTask();
     return $array;
 }
 public function toArray()
 {
     $array = parent::toArray();
     $array['text'] = $this->getText();
     $array['icon'] = $this->getIcon();
     $array['destination'] = $this->getDestination();
     $array['image'] = $this->getImage();
     return $array;
 }
Exemple #4
0
 public function toArray()
 {
     $array = parent::toArray();
     $array['user'] = $this->getUser();
     $array['image'] = $this->getImage();
     $array['commentsUrl'] = "/posts/{$this->id}/comments";
     if ($user = Auth::user()) {
         /** @var User $user */
         $array['liked'] = $this->getLikeManager()->userLikes($user);
     } else {
         $array['liked'] = null;
     }
     return $array;
 }
Exemple #5
0
 public function toArray()
 {
     $array = parent::toArray();
     $array['bgUrl'] = $this->getBgUrl();
     /** @var User $user */
     if ($user = Auth::user()) {
         $toDoManager = new ToDoManager();
         $array['isOnToDoList'] = $toDoManager->userHasTaskToDo($this, $user);
         $array['hasCompleted'] = $user->hasCompletedTask($this);
     }
     $array['cost'] = $this->cost ? round($this->cost) : null;
     $array['time'] = $this->time ? round($this->time) : null;
     $array['rating'] = $this->rating ? round($this->rating) : null;
     return $array;
 }
 public function toArray()
 {
     $array = parent::toArray();
     $array['user'] = $this->getUser();
     $array['repliesUrl'] = "/comments/{$this->id}/replies";
     if ($user = Auth::user()) {
         /** @var User $user */
         $array['liked'] = $user->likesComment($this->id);
     } else {
         $array['liked'] = null;
     }
     if (is_array($this->loadedReplies)) {
         $array['replies'] = $this->loadedReplies;
     }
     return $array;
 }
Exemple #7
0
 /**
  * @return array
  */
 public function toArray()
 {
     $array = parent::toArray();
     if (!Auth::check() || Auth::user()->id !== $this->id) {
         unset($array['email']);
         unset($array['admin']);
         unset($array['updatedAt']);
     }
     if ($image = $this->getImage()) {
         $array['imageUrl'] = $image->getUrl();
         $array['imageThumbUrl'] = $image->thumb ? $image->getThumbUrl() : $image->getUrl();
     } else {
         $array['imageUrl'] = null;
         $array['imageThumbUrl'] = null;
     }
     $array['possessiveName'] = LangHelpers::possessive($this->username);
     return $array;
 }
 public function toArray()
 {
     $array = parent::toArray();
     $array['user'] = $this->getUser();
     $array['sticker'] = $this->getSticker();
     $array['task'] = $this->getTask();
     $array['post'] = $this->postId ? $this->post : null;
     $array['comment'] = $this->commentId ? $this->comment : null;
     $this->setupForType();
     $array['action'] = $this->action;
     $user = Auth::getUser();
     if ($this->likeManager) {
         $array['likeCount'] = $this->likeManager->getCount();
         if ($user) {
             $array['liked'] = $this->likeManager->userLikes($user);
         }
     }
     return $array;
 }
 public function toArray()
 {
     $array = parent::toArray();
     $array['imageUrl'] = $this->getImageUrl();
     return $array;
 }