dimanche 17 janvier 2016

Paginate and get() are not working together in Laravel 5.1

hi i am trying to set pagination and get together in laravel 5.1, here is what i am trying to do:

$bridal_requests_data = \DB::table('bridal_requests')->leftJoin('audiences', function($join) {
                        $join->on('bridal_requests.id', '=', 'audiences.request_id');
                        })
                        ->orderBy('bridal_requests.id', 'DESC')->paginate('15', array('bridal_requests.*'));

it is giving the following error:

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '*) as aggregate from bridal_requests left join audiences on bridal_requests' at line 1 (SQL: select count(bridal_requests.*) as aggregate frombridal_requestsleft joinaudiencesonbridal_requests.id=audiences.request_id`)

as it stated above, it is not working for "bridal_requests.*", but if i use brial_requests.id then it works, but i need to use get all data from bridal_requests table,

Please help me to sort out this issue.

Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire