Search
 
SCRIPT & CODE EXAMPLE
 

PHP

show random post in laravel

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

PREVIOUS NEXT
Code Example
Php :: acf repeater 
Php :: php stop execution 
Php :: laravel remove foreign key 
Php :: lumen file upload 
Php :: php zeilenumbruch 
Php :: install php-8 
Php :: how to start laravel project 
Php :: how to use flash message in laravel 
Php :: php use variable as object key 
Php :: IlluminateDatabaseEloquentCollection to array 
Php :: php required 
Php :: add categories to custom post type 
Php :: get id php 
Php :: php string underscore into camelcase 
Php :: laravel force delete 
Php :: debian php switch version 
Php :: php begin 
Php :: how make factory and seeder in laravel 8 
Php :: show alert in php 
Php :: Syntax error or access violation: 1071 Specified key was too long; 
Php :: laravel collection keys 
Php :: convert timestamp to date php 
Php :: duplicate record laravel 
Php :: catch any exception php 
Php :: php call class dynamically 
Php :: how to make classess in php 
Php :: laravel take value from different array by key 
Php :: join in laravel 
Php :: laravel 8 check if record exists 
Php :: laravel truncate string laravel 8 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =