Example of Collection Methods: Chunk in laravelio/laravel.io

File app/Http/Controllers/HomeController.php (link to Github)
use App\Models\User;
use Illuminate\Support\Facades\Cache;

class HomeController extends Controller
{
    public function show()
    {
        $communityMembers = Cache::remember('communityMembers', now()->addMinutes(5), function () {
            return User::withCounts()
                ->hasActivity()
                ->whereNull('banned_at')
                ->inRandomOrder()
                ->take(100)
                ->get()
                ->chunk(20);
        });
       //
    }
    //
}