raw sum query on laravel join code example
Example 1: laravel not in query
DB::table(..)->select(..)->whereNotIn('book_price', [100,200])->get();
Example 2: laravel orWhere
$camps = $field->camps()->where('status', 0)->where(function ($q) {
$q->where('sex', Auth::user()->sex)->orWhere('sex', 0);
})->get();
Example 3: laravel join query sum example
$users = User::select('users*', 'analytics.*', DB::raw('SUM(analytics.revenue) As revenue'))
->leftJoin('analytics', 'analytics.user_id', '=', 'users.id')
->where('analytics.date', Carbon::today()->toDateString())
->get();