Преглед на файлове

Use inRandomOrder instead of orderByRaw in Discover page

Neil Alexander преди 7 години
родител
ревизия
11447c13da
променени са 1 файла, в които са добавени 1 реда и са изтрити 1 реда
  1. 1 1
      app/Http/Controllers/DiscoverController.php

+ 1 - 1
app/Http/Controllers/DiscoverController.php

@@ -16,7 +16,7 @@ class DiscoverController extends Controller
     public function home()
     {
       $following = Follower::whereProfileId(Auth::user()->profile->id)->pluck('following_id');
-      $people = Profile::whereNotIn('id', $following)->orderByRaw('rand()')->take(3)->get();
+      $people = Profile::inRandomOrder()->whereNotIn('id', $following)->take(3)->get();
       $posts = Status::whereHas('media')->whereNotIn('profile_id', $following)->orderBy('created_at', 'desc')->take('21')->get();
       return view('discover.home', compact('people', 'posts'));
     }