. */ namespace Poniverse\Ponyfm\Mail; use Poniverse\Ponyfm\Models\User; class NewComment extends BaseNotification { /** * @inheritdoc */ public function build() { $creatorName = $this->initiatingUser->display_name; // Profile comments get a different template and subject line from // other types of comments. if ($this->activityRecord->getResourceType() === User::class) { return $this->renderEmail( 'new-comment-profile', $this->activityRecord->text, [ 'creatorName' => $creatorName, ]); } else { return $this->renderEmail( 'new-comment-content', $this->activityRecord->text, [ 'creatorName' => $creatorName, 'resourceType' => $this->activityRecord->getResourceType(), 'resourceTitle' => $this->activityRecord->resource->resource->title, ]); } } }