Pre-1.0. Not intended for public use yet. The API is subject to undocumented change, and these pages may already be wrong about it.

Skip to content

Choosing What to Group ​

Introduction ​

A busy restaurant records dozens of activities an hour: orders placed, menus edited, dishes marked sold out. A manager scanning the feed wants the overview, such as who was busy and where. A chef reading reviews wants each one in full. Grouping everything hides the reviews, and grouping nothing buries the overview.

Group activities when the reader needs an overview of who acted and where. Keep separate rows when each event's words, time or recorded details matter.

Choosing by the Reader's Task ​

Kind of activityA useful starting point
Signals, such as reactions or check-insGroup when the reader mainly needs to know who participated and where.
Content, such as comments, questions or notesKeep each contribution visible, including its body and attribution.
Bulk work, such as an upload or several completed tasksName the shared action and destination, then let the reader inspect members.
System mechanics, such as indexing and retriesUsually omit them from a person's feed; show a meaningful outcome when there is one.

These are choices for a particular feed. An order-view count may be enough on an overview, while an investigation needs every view's time and recorded details. Start with what the reader needs to decide, then choose the read mode.

Grouping Routine Signals ​

A group of check-ins can answer “who is here?” without a separate headline for each person:

Murray Bauman
JT
Jasper Tey checked in at the Fun Fair
Karen Wheeler

The sentence names the place as well as the people. Prefer that to an isolated “5 check-ins”. A reaction group should likewise name the thing people reacted to. Choose a grouping axis whose activities share the role you want to name. The built-in actors axis requires the same object. The actors_target axis requires the same target; its objects may differ.

Show a small sample of names and the number remaining. The payload's sample and distinct fields support that presentation. Use count for activities and distinct for people or objects; one person can act more than once.

Keeping Content Visible ​

Each notice below has something different to read. A count would hide the reason to open the feed:

Steve Harrington

Starcourt Mall visitor guide

The visitor guide includes entrances, parking and shop locations.

Steve Harrington

Scoops Ahoy opening hours

The counter opens at 10 am. Orders are available until 9 pm.

The same applies to comments, questions and quoted notes when their words matter. Retrieve individual activities with log() and render their bodies. A compact layout may reduce repeated avatars or headings while keeping every contribution and timestamp; that is a choice in your renderer, not a different Storyfeed read mode.

When each view is evidence, keep those rows separate too:

A controller, or wherever the feed is retrieved
php
use Storyfeed\Facades\Storyfeed;

$views = Storyfeed::feed()
    ->only('view')
    ->log()
    ->get();
Steve Harrington
Steve Harrington
Steve Harrington
Steve Harrington
Steve Harrington

Add ->involving($document) when the reader is investigating one document. Display the event details your application recorded, such as the time and whether the request was automated. Storyfeed does not infer those details from the verb. Grouping preserves the activities, but a collapsed sentence puts their evidence behind another interaction.

Summarizing Bulk Work ​

An upload group names the destination and keeps the photos available to inspect:

JB
Jonathan Byers uploaded 3 photos to the Hawkins Post
A room lit redArcade machines in a dark roomA small-town street from above

For work deliberately submitted together, consider a composite: one published activity with a collection of objects. Activities that merely happen near each other can use ordinary aggregation. Neither approach replaces the member content with the headline.

When members have names stored in activity data, show one or two names followed by the remaining count. Naming Group Members From Activity Data shows how to limit the displayed names. Count all members, including those omitted from the response. A group node nests at most grouping.children_limit members; a “Show all” control fetches the rest with members().

Showing System Outcomes ​

A recorded payment can be useful even when a service is the actor:

S
Stripe marked Order #1035 paid

The actor and the affected order explain the event. Indexing, cache rebuilds and successful retries usually add no comparable information for the reader. Choose what to record before trying to hide that volume in a group. For already-recorded events, a feed's only() or except() filters can select what its readers need.

Choosing the Read Mode ​

Offer a grouped overview and a separate history of the same data when readers need both. See Choosing a Read Mode for live() and log().

keepLatest() and retention change which events remain available. Use them only when that matches the history you intend to keep, rather than as display settings for a crowded feed.

Released under the MIT License.