A client-facing general announcement.

Announcements provide the operator a method to post a message for all clients.

These messages will be displayed in an alert box on the Client's home page.

class Announcement extends AbstractModel

Properties summary

Type Property Description
protected $table
protected $columnMap
protected $dates
protected $booleans
int $id Unique ID number for this announcement.
Carbon $publishDate The most recent date the "Published" checkbox was set for this announcement (not necessarily the same as the creation date).
string $title Title to display for the announcement.
string $announcement Content of the announcement, in HTML.
bool $isPublished State of the "Published" checkbox. On true, the announcement is displayed to clients.
int $parentId If this announcement is a translation, this ID points to the source of the translation. Otherwise it's 0.
string $language English language internal name of the language used in this translation.
Carbon $createdAt Date this announcement was originally created.
Carbon $updatedAt Date this announcement was last updated.
Announcement $parent If this is a translation of another announcement, this property points to the source Announcement object.
Collection|Announcement[] $translations If this announcement has translations provided, this is an array of those Announcement objects.

Methods summary

Return Type Method Name Description
static  boot() -
HasOne parent() An announcement may have a parent announcement.
HasMany translations() An announcement may be a parent of many child announcements.
static Collection|Carbon[] getUniqueMonthsWithAnnouncements(int $count = 10) Retrieve a list of the past months in which announcements were posted.
Builder scopeTranslationsOf(Builder $query, string $id = '', string $language = '') -
bestTranslation($language = '') -
scopePublished(Builder $query) -

Details

static boot ()

HasOne parent ()

An announcement may have a parent announcement.

Return Value

HasOne

HasMany translations ()

An announcement may be a parent of many child announcements.

Return Value

HasMany

static Collection|Carbon[] getUniqueMonthsWithAnnouncements (int $count = 10)

Retrieve a list of the past months in which announcements were posted.

Parameters

int $count

Return Value

Collection|Carbon[]

Builder scopeTranslationsOf (Builder $query, string $id = '', string $language = '')

Parameters

Builder $query
string $id
string $language

Return Value

Builder

bestTranslation ($language = '')

Parameters

$language

scopePublished (Builder $query)

Parameters

Builder $query