Code Explainers

Code explainers tagged #reporting

php
<?php
 
namespace App\Reports;
 

Bucketing spending by time period in Laravel

aggregation date-bucketing collections
Intermediate 9 steps
php
public function customerTotals(Request $request): Collection
{
    return DB::table('orders')
        ->join('customers', 'customers.id', '=', 'orders.customer_id')

Building an aggregate report with Laravel's query builder

query builder aggregation conditional queries
Intermediate 8 steps
python
from django.db.models import Sum, Count, F, DecimalField
from django.db.models.functions import TruncMonth, Coalesce
 
from .models import Order

Build a monthly revenue report in Django

aggregation orm group-by
Advanced 7 steps