ldc-bien-etre-animal/app/Services/NewsRepository.php
2026-08-28 10:40:04 +02:00

29 lines
613 B
PHP

<?php
declare(strict_types=1);
namespace App\Services;
class NewsRepository
{
/**
* @return array<int, array<string, mixed>>
*/
public static function all(): array
{
$translations = trans('news_articles_page');
return collect($translations)
->map(fn ($article, $slug) => array_merge(['slug' => $slug], $article))
->values()
->all();
}
/**
* @return array<string, mixed>|null
*/
public static function findBySlug(string $slug): ?array
{
return collect(self::all())->firstWhere('slug', $slug);
}
}