$trans['meta']['title'], 'metaDescription' => $trans['meta']['description'], 'heroVideoSrc' => $trans['hero']['video_src'], 'stats' => $trans['chiffres_cles']['stats'], 'brands' => $trans['marques']['brands'], 'testimonials' => $this->getTestimonials($trans), 'featuredArticles' => $this->getFeaturedArticles(), ]); } /** * @param array $trans * @return array> */ private function getTestimonials(array $trans): array { /** @var array> $testimonials */ $testimonials = $trans['rejoindre']['testimonials'] ?? []; return collect($testimonials) ->map(fn ($t) => [ 'quote' => $t['quote'], 'authorName' => $t['author_name'], 'authorRole' => $t['author_role'], 'authorPhoto' => $t['author_photo'], 'logo' => $t['logo'], ])->all(); } /** * @return array> */ private function getFeaturedArticles(): array { return collect(NewsRepository::all()) ->take(3) ->map(fn ($a) => [ 'slug' => $a['slug'], 'title' => $a['title'], 'excerpt' => $a['excerpt'], 'date' => $a['date'], 'rotation' => $a['rotation'], ]) ->values() ->all(); } }