LaravelDaily / quickadmin

Quick adminpanel builder package for Laravel 5
MIT License
600 stars 192 forks source link

CRUD controller's index action should use paginate instead of all #130

Open saidbakr opened 6 years ago

saidbakr commented 6 years ago

I have a Products CRUD controller that seems like:

public function index(Request $request)
    {
        $products = Products::all();

        return view('admin.products.index', compact('products'));
    }

In this way a serious performance issue should be occurred with large data models. I think it will be better if ::paginate() used instead of all()

PovilasKorop commented 6 years ago

@saidbakr we gladly would accept a pull request for this, but please beware that then Datatables pagination wouldn't work.

We have AJAX Datatables version in our online generator - https://quickadminpanel.com - see more here: https://quickadminpanel.com/pages/ajax-datatables-module