/** * @return string */ public function getThumbnailAttribute() { $photo = $this->avatar; if ($photo == null) { return Photo::samplePhotoUrl(); } return $photo->src; }
public function getCoverAttribute() { if ($this->profile->cover == NULL) { return Photo::samplePhotoUrl(); } /** @var Photo|null $cover */ $cover = $this->profile->cover; return $cover->src; }
/** * If an article not have cover, replace by its tagged destination's image * @return string URL of article cover image */ public function getThumbnailAttribute() { /** @var Photo $thumbPhoto */ try { $thumbPhoto = $this->cover_id != null ? Photo::find($this->cover_id) : $this->first_related_destination->avatar; return $thumbPhoto->src; } catch (\Exception $e) { return Photo::samplePhotoUrl(); } }