1,
'title' => 'First One',
'slug' => '1st',
'body' => 'First!!1
lol',
],
[ 'id' => 2,
'title' => 'Second One',
'slug' => '2nd',
'body' => 'Second i do concour
lmfao',
],
[ 'id' => 3,
'title' => 'Third One',
'slug' => '3rd',
'body' => 'Third indeed
xD',
],
];
}
public static function find(string $slug): array
{
$article = Arr::first(Article::all(), fn($article) => $article['slug'] === $slug);
if(! $article ) {
abort(404);
}
return $article;
}
}