/** * {@inheritdoc} */ protected function getDefaultAttributes($user) { $attributes = parent::getDefaultAttributes($user); if ($user->id == $this->actor->id) { $attributes += ['readTime' => $user->read_time ? $user->read_time->toRFC3339String() : null, 'unreadNotificationsCount' => $user->getUnreadNotificationsCount(), 'preferences' => $user->preferences]; } return $attributes; }
/** * {@inheritdoc} */ protected function getDefaultAttributes($user) { $attributes = parent::getDefaultAttributes($user); $attributes += ['isActivated' => $user->is_activated, 'email' => $user->email, 'readTime' => $this->formatDate($user->read_time), 'unreadNotificationsCount' => (int) $user->getUnreadNotificationsCount(), 'newNotificationsCount' => (int) $user->getNewNotificationsCount(), 'preferences' => (array) $user->preferences]; return $attributes; }