Esempio n. 1
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;
 }