extensionEnabled('flarum-tags')) { $filters['tags'] = $discussion->tags->pluck('id')->toArray(); } return $filters; } public function fulltext(Discussion $discussion): array { return [ 'title' => $discussion->title, 'content' => $discussion->firstPost?->content ]; } public static function index(): string { return 'discussions'; } public static function model(): string { return Discussion::class; } public static function savingOn(Dispatcher $events, callable $callable) { $events->listen(Started::class, function (Started $event) use ($callable) { return $callable($event->discussion); }); } public static function deletingOn(Dispatcher $events, callable $callable) { $events->listen([Deleted::class, Hidden::class], function ($event) use ($callable) { if ($event->discussion->is_private) return; return $callable($event->discussion); }); } }