ldc-bien-etre-animal/app/Services/NewsRepository.php

30 lines
613 B
PHP
Raw Permalink Normal View History

2026-08-28 08:40:04 +00:00
<?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);
}
}