Loading all the data at once will make the page load slower. Is there any way to load only 10 records and load the others if the user clicks to page 2 or something?
Below is the code I used to load all data. It works just fine but when I import 5,000 records, it crashes the page to error 500 because of the slow loading
public function index()
{
$users = User::all();
$documents = Receiving::where('draft', '=', 0)->get();
return view('documents/index', compact('users', 'documents'));
}
when I use paginate(); it would only show 1 page