bus = $bus; $this->floodgate = $floodgate; } /** * {@inheritdoc} */ protected function data(ServerRequestInterface $request, Document $document) { $actor = $request->getAttribute('actor'); $ipAddress = $request->getAttribute('ipAddress'); if (! $request->getAttribute('bypassFloodgate')) { $this->floodgate->assertNotFlooding($actor); } $discussion = $this->bus->dispatch( new StartDiscussion($actor, Arr::get($request->getParsedBody(), 'data', []), $ipAddress) ); // After creating the discussion, we assume that the user has seen all // of the posts in the discussion; thus, we will mark the discussion // as read if they are logged in. if ($actor->exists) { $this->bus->dispatch( new ReadDiscussion($discussion->id, $actor, 1) ); } return $discussion; } }