Sometimes, when you write blogs or any website then you might need to get any random rows to display.
inRandomOrder
To Get Random RowsWith the help of inRandomOrder
we can get the random rows.
$randomPosts = Post::inRandomOrder()->get();
But wait this will get all the random generated posts. You can use the limit the rows in the following way
$randomPosts = Post::published()->inRandomOrder()->limit(15)->get();
return view($this->getView('post.show'), [
'post' => $post,
'randomPosts' => $randomPosts
]);
Free SSL Certificate In cPanel With ZeroSSL & Certbot
Generate RSS Feeds in PHP Laravel
Lazy Load YouTube And Other Videos In Website
Use Different PHP Versions In Ubuntu / Linux
Push Files To CPanel / Remote Server using FTP Software FileZilla
composer.json v/s composer.lock
Generate Fake Data In PHP With Faker
Debugging Laravel Queue Email Issues
Comment And Like System Using Disqus
Add Analytics To AMP (Accelerated Mobile Pages) HTML Pages
Sass or SCSS @function vs @mixin