vendredi 18 décembre 2015

Laravel Pagination when using a MySQL Stored Procedure

This might be an old question but it seems I can't get around this problem. I have a Laravel 5.0 API which calls a procedure that retrieves data from multiple tables. The retrieved is around 50-80 rows and I would like to have a pagination on the results of the service.

This is the code:

      $infoList = DB::connection('mysql')->select(
            DB::raw('CALL dbname.GetAllUserInfo()'));

Is there a way to paginate the results of this? Even if I convert the array to a class and use ->paginate(15) it gives me an error that the Call to undefined method stdClass::paginate(). I've tried using foreach to create the object but still cannot use pagination. Any suggestions, please? I'm a beginner in Laravel.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire