> */ public function __invoke(User $user, string $search, int $limit): array { $query = NewsPost::query()->published()->visibleTo($user)->with('category'); GlobalSearch::whereTerms($query, ['title', 'teaser', 'body'], $search); return $query->latest('published_at')->limit($limit)->get()->map(fn (NewsPost $post) => [ 'title' => $post->title, 'url' => route('news.show', $post->slug), 'excerpt' => GlobalSearch::excerpt($post->teaser.' '.$post->body_html, $search), 'meta' => collect([$post->category?->name, $post->published_at?->translatedFormat('j. F Y')])->filter()->implode(' · '), 'image' => $post->coverUrl('thumb'), ])->all(); } }