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 Not to Record ​

Publish activities that help people follow what happened. Routine saves, drafts, and background work usually do not belong in the feed.

Choosing Events to Record ​

EventRecord It?Reason
model created as a draftnoit is not ready for others to act on
save with no status changenono visible change occurred
note text editednothe note's body already displays its current text
background indexing, cache rebuilding, or setting a dirty flagnointernal maintenance is not useful feed content
someone typing or coming onlinenothe state may change within seconds
field-level audit recordnokeep detailed change history in an audit log
status transitionyeseach transition describes an event; see Choosing When to Publish
question asked about a menu itemyesthe activity identifies the subject and can quote the question
order placedyesothers can follow the order's progress
order viewedtemporarilyuse the verb's retention period to limit how long it remains

Skipping Publication ​

For an event implementing PublishesToFeed, check whether to publish in toFeedActivity():

app/Events/OrderPlaced.phptoFeedActivity()
php
if ($this->order->status === 'draft') {
    return null;                                 // not an activity
}

return Storyfeed::activity()
    ->by($this->customer)
    ->action('place', $this->order)
    ->to($this->order->shop);

Returning null publishes nothing. See Publishing from Events.

app/Providers/AppServiceProvider.phpboot()
php
use Storyfeed\ActivityStreams\ActivityType;
use Storyfeed\Facades\Storyfeed;

Storyfeed::verbs([
    'place' => ActivityType::Create,
]);
routes/feed.php
php
use App\Models\Order;
use Storyfeed\Facades\Story;

Story::for(Order::class)->verb('place')
    ->headline(':actor placed :object with :target');

Released under the MIT License.