performedOn($subject) ->causedBy(auth('staff')->user()) ->withProperties(['attributes' => $attributes]) ->log('created'); } /** * Log an update event. $old holds the previous values, $attributes the new ones. */ public function updated(Model $subject, array $old, array $attributes): void { activity('lunar') ->performedOn($subject) ->causedBy(auth('staff')->user()) ->withProperties(['old' => $old, 'attributes' => $attributes]) ->log('updated'); } /** * Log a failed operation. $attributes provides context (e.g. error message, service). */ public function failed(Model $subject, array $attributes): void { activity('lunar') ->performedOn($subject) ->causedBy(auth('staff')->user()) ->withProperties(['attributes' => $attributes]) ->log('failed'); } /** * Log a deletion event. $attributes provides context (e.g. reason, name). */ public function deleted(Model $subject, array $attributes): void { activity('lunar') ->performedOn($subject) ->causedBy(auth('staff')->user()) ->withProperties(['attributes' => $attributes]) ->log('deleted'); } }