jim1506
1 week ago
100
10
Eloquent

Count in a joined table with DB

Posted 1 week ago by jim1506

I have some code to get data for a datatable

$pr = DB::table('properties') ->leftJoin('photos', 'properties.id', '=', 'photos.property_id') ->select(['properties.id', 'address', 'town', 'postcode', 'units','unitType','examination','priority','completed','quotationRequired']);

This works fine but I would like to add the count of photos in my select statement.

Help appreciated!

Please sign in or create an account to participate in this conversation.