I am working in laravel 5.3. I have issue to run query.I am trying for groupby query but its not working and error like Call to undefined method Illuminate\Database\Query\Builder::only_full_group_by(). My code like
public function showcart()
{
$cart = DB::table('cartshow')->only_full_group_by('pro_id')->get(); die();
$i = 1;
foreach($cart as $tt)
{
$count = DB::table('cartlist')->where('pro_id',$tt->pro_id)->sum('qnty');
$sel_pro= DB::table('product') -> where('id',$tt->pro_id)->first();
$proname = $sel_pro->name;
$price = ($sel_pro->price) * $count;
echo $cartdata ="<tr>
<td>$proname<br><small>Swaminarayan, Extra Hot, Cheese</small></td>
<td style='vertical-align:middle'>
<input type='button' value='-' onclick='qtyminus($tt->pro_id);' class='qtyminus' field='quantity' />
<input type='text' name='quantity' value='$count' class='qty' id='txt$tt->pro_id'/>
<input type='button' value='+' onclick='qtyplus($tt->pro_id);' class='qtyplus' field='quantity' />
</td>
<td class='text-right' style='vertical-align:middle'><button data-id ='$tt->pro_id' type='button' class='btn btn-xs btn-info'><i class='fa fa-remove'></i></button></td>
</tr>";
}
}
only_full_group_bymethod in Laravel, am I missing something ? Can you post the reference to your method ? - jaysingkaronly_full_group_byis default. So, instead usegroupBy(). - jaysingkar