Dynamic messages
messages() accepts an iterable or a closure. Closures run through Laravel’s
container and can receive AnnouncementBar $bar or injected services. For a
reusable source, implement the provider contract:
Announcement instances with unique IDs; at most 50 source entries are accepted,
including entries later filtered by visibility. Calling messages() clears an
earlier provider. A later provider() becomes the active source.
Your source owns database filtering, tenant scope and access checks. Do not send
unfiltered sensitive messages and try to hide them with CSS. The Livewire owner
requires an authenticated user who can access its panel, but that is not a
replacement for provider-level authorization.
Refresh when something changes
Dispatch the configured Livewire event after an authorized application change:listen() also accepts native Livewire/Echo event names or a closure returning
them. Your application supplies Echo, channel authentication and the event
transport. Subscriptions are resolved when the owner mounts; remount when a
tenant change alters channel identifiers. This feature does not install a push
server or broadcast database changes automatically.
Optional polling and caching
poll(null) disables it. Polling uses native visible-owner Livewire polling.
Caching is disabled by default and accepts 1–86400 seconds or null to disable.
Polling respects the display cache TTL; a 30-second poll does not guarantee a
new source query when cached for 60 seconds.
Cache keys always include panel, user, tenant and locale scope, bar ID, revision
and your optional namespace. cache() also accepts a namespace closure receiving
AnnouncementBar $bar and string $scope. A namespace does not remove these
scope boundaries. Cache stores resolved display arrays in Laravel’s configured
cache; it does not cache executable handlers.
Explicit refresh and configured events invalidate the current scope. Change a
revision or namespace when deploying changed cached content. For frequently
changing permissions, leave caching off or include an application permission
version in the namespace. Server actions always resolve current message
eligibility again instead of trusting a cached/client-supplied ID.
cacheKey($scope) and forgetCachedMessages($scope) are available for code that
already owns the correct scope. For ordinary UI changes prefer the refresh
event, which refreshes the mounted owner’s own scope.
Browser commands
Commands require the target bar
id. They control presentation; they do not
authorize access or change server schedules. Selecting a hidden, dismissed or
inactive message does not make it eligible.
Observe events
id and the
relevant messageId; some events also include the data below.
Client events are not an authoritative audit trail. Owners release subscriptions,
timers and observers when removed. An inactive placement initializes when it
gets a layout width; ordinary below-the-fold content keeps its owner. If the
runtime fails to load, server-rendered text and ordinary links remain available.