Database: Query Builder - Laravel - The PHP Framework For Web Artisans ( RAW )

PHOTO EMBED

Fri Apr 30 2021 16:50:09 GMT+0000 (Coordinated Universal Time)

Saved by @mvieira #php

$orders = DB::table('orders')
                ->select('department', DB::raw('SUM(price) as total_sales'))
                ->groupBy('department')
                ->havingRaw('SUM(price) > ?', [2500])
                ->get();
content_copyCOPY

https://laravel.com/docs/8.x/queries