whereIn('action_name', $actions);
}
return $query;
}
public function scopeBySpace($query, $spaceId)
{
if ($spaceId) {
return $query->where('space_id', $spaceId);
}
return $query->where('space_id', $spaceId);
}
public function feed()
{
return $this->belongsTo(Feed::class, 'feed_id');
}
public function space()
{
return $this->belongsTo(BaseSpace::class, 'space_id');
}
public function user()
{
return $this->belongsTo(User::class, 'user_id');
}
public function xprofile()
{
return $this->belongsTo(XProfile::class, 'user_id', 'user_id');
}
public function getFormattedMessage()
{
if (!$this->xprofile || !$this->feed) {
return '';
}
$message = '';
switch ($this->action_name) {
case 'feed_published':
/* translators: %1$s is the person name and %2$s is the feed excerpt */
$message = sprintf(__('%1$s published a new status %2$s', 'fluent-community'), '' . $this->xprofile->display_name . '', '' . $this->feed->getHumanExcerpt() . '');
break;
case 'comment_added':
/* translators: %1$s is the person name and %2$s is the feed excerpt */
$message = sprintf(__('%1$s added a comment on %2$s', 'fluent-community'), '' . $this->xprofile->display_name . '', '' . $this->feed->getHumanExcerpt() . '');
break;
}
return $message;
}
}