Laravel - Eloquent havingRaw() query Example

10-Apr-2023

.

Admin

Laravel - Eloquent havingRaw() query Example

Hi friends,

In this post, we will learn eloquent havingRaw() query. i explained simply step by step laravel havingRaw() example. Here you will learn laravel havingRaw() sum. This tutorial will give you simple example of havingRaw() in laravel. You just need to some step to done laravel havingRaw() max.

You will any table having to raw then change particular raw data. you can use havingRaw in example.

So let's see bellow example:

Laravel Query :


$data = DB::table('products')

->select('products', DB::raw('SUM(price) as total_amount'))

->groupBy('products')

->havingRaw('SUM(price) > ?', [2000])

->get();

dd($data);

I hope it will help you....

#Laravel