Feb 2, 2017
0
Level 1
Laravel 5.3 : pagination orm left join query results gives empty
I am trying to paginate a left join query result
here is my code
$result = Art::leftJoin('cushbu_users',function ($join){
$join->on('cushbu_arts.artist_id', '=', 'cushbu_users.id');
})
->where('category',$category)
->where('status',1)
->paginate(1,[
'cushbu_users.name as artistName',
'cushbu_arts.id',
'cushbu_arts.title',
'cushbu_arts.slug',
'cushbu_arts.width',
'cushbu_arts.height',
'cushbu_arts.depth',
'cushbu_arts.base_price',
'cushbu_arts.cropped_image',
'cushbu_arts.category'
]);
dd($result);
But the collections give empty result
LengthAwarePaginator {#221 ▼ #total: 3 #lastPage: 3 #items: Collection {#204 ▼ #items: [] } #perPage: 1 #currentPage: 5 #path: "http://localhost/cushbu/public/category/Painting" #query: [] #fragment: null #pageName: "page"
Please or to participate in this conversation.