true, 'startUser' => true, 'lastUser' => true, 'startPost' => true, 'lastPost' => true ]; /** * @inheritdoc */ public static $link = []; /** * @inheritdoc */ public static $limitMax = 50; /** * @inheritdoc */ public static $limit = 20; /** * @inheritdoc */ public static $sortFields = []; /** * @inheritdoc */ public static $sort; /** * Instantiate the action. * * @param Dispatcher $bus */ public function __construct(Dispatcher $bus) { $this->bus = $bus; } /** * Create a discussion according to input from the API request. * * @param JsonApiRequest $request * @return \Flarum\Core\Discussions\Discussion */ protected function create(JsonApiRequest $request) { $actor = $request->actor; $discussion = $this->bus->dispatch( new StartDiscussion($actor, $request->get('data')) ); // 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; } }