show random post in laravel

39

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

Comments

Submit
0 Comments