Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

show random post in laravel

public function getRandomPost() {
        $post = Post::inRandomOrder()->first();
        return redirect()->route('posts.show', ["id" => $post->id]);
    }
Source by laracasts.com #
 
PREVIOUS NEXT
Tagged: #show #random #post #laravel
ADD COMMENT
Topic
Name
3+5 =