use builder for query
This commit is contained in:
@@ -14,7 +14,6 @@ class CumulativeMessageRatingStatsController extends Controller
|
||||
public function index(Request $request): JsonResponse
|
||||
{
|
||||
$query = DB::table('country_message_rating_reports')->selectRaw("
|
||||
SELECT
|
||||
province_id,
|
||||
province_name,
|
||||
SUM(total) as total,
|
||||
@@ -26,11 +25,9 @@ class CumulativeMessageRatingStatsController extends Controller
|
||||
SUM(action3) as action3,
|
||||
SUM(action4) as action4,
|
||||
SUM(action5) as action5
|
||||
GROUP BY province_id, province_name
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
")
|
||||
->groupBy('province_id', 'province_name')
|
||||
->unionAll(DB::table('country_message_rating_reports')->selectRaw("
|
||||
0 as province_id,
|
||||
'کشوری' as province_name,
|
||||
SUM(total),
|
||||
@@ -42,7 +39,7 @@ class CumulativeMessageRatingStatsController extends Controller
|
||||
SUM(action3),
|
||||
SUM(action4),
|
||||
SUM(action5)
|
||||
");
|
||||
"));
|
||||
|
||||
return response()->json(
|
||||
DataTableFacade::run(
|
||||
|
||||
Reference in New Issue
Block a user