show random post in laravel code example
Example: show random post in laravel
public function getRandomPost() {
$post = Post::inRandomOrder()->first();
return redirect()->route('posts.show', ["id" => $post->id]);
}
public function getRandomPost() {
$post = Post::inRandomOrder()->first();
return redirect()->route('posts.show', ["id" => $post->id]);
}