Wednesday, March 8, 2017

how to use find count using raw method in query builder on laravel

I am trying to find count of gender using the raw statement but i get this error

Parse error: syntax error, unexpected '$total' (T_VARIABLE). Can someone please tell me whats my error

$collection='{gender:"Male"}'                    
$total = DB::collection('leads')->raw(function($collection)
{
    return $collection->find();
});
return  $total;



via Sanjana Anand

Advertisement