post random 2 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]);
}