laravel4-datatables-package icon indicating copy to clipboard operation
laravel4-datatables-package copied to clipboard

Not getting all results

Open asalkey opened this issue 10 years ago • 1 comments
trafficstars

I am not able to get all the results only the last one here is what I have in the controller

            DB::table('vendor')
            ->join('contractor_category_vendor', 'contractor_category_vendor.vendor_id', '=', 'vendor.id')
            ->join('contractor_category', function($join)
                {
                    $join->on('contractor_category.id', '=', 'contractor_category_vendor.contractor_category_id');
                })
            ->select('contractor_category.contractor_type');

The vendor is associated to many categories and it's only pulling the last one not all of them.

asalkey avatar Dec 08 '14 21:12 asalkey

If you run ->toSql() you get following query

select `contractor_category`.`contractor_type` from `vendor` inner join `contractor_category_vendor` on `contractor_category_vendor`.`vendor_id` = `vendor`.`id` inner join `contractor_category` on `contractor_category`.`id` = `contractor_category_vendor`.`contractor_category_id`

Does running that in phpmyadmin show the results you expect?

MarkVaughn avatar Dec 16 '14 23:12 MarkVaughn