# fluent-cart/1.3.25/app/Http/Controllers/Reports/SourceReportController.php

FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler, version 1.3.25. 44 lines.

- Page: https://pluginprobe.com/plugins/fluent-cart/1.3.25/code/app/Http/Controllers/Reports/SourceReportController.php
- Raw: https://pluginprobe.com/plugins/fluent-cart/1.3.25/raw/app/Http/Controllers/Reports/SourceReportController.php
- Modified: 2025-10-29T13:35:30+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/fluent-cart/1.3.25/code/app/Http/Controllers/Reports/SourceReportController.php#L10-L20`.

```php
<?php

namespace FluentCart\App\Http\Controllers\Reports;

use FluentCart\Framework\Http\Request\Request;
use FluentCart\App\Http\Controllers\Controller;
use FluentCart\App\Services\Report\ReportHelper;
use FluentCart\App\Services\Report\SourceReportService;

class SourceReportController extends Controller
{
    protected $params = [
        'orderTypes',
        'paymentStatus',
    ];

    public function index(Request $request): array
    {
        $params = ReportHelper::processParams($request->get('params'), $this->params);

        $service = SourceReportService::make();

        $currentMetrics = $service->getSourceReportData($params);

        $fluctuations = [];

        if ($params['comparePeriod']) {
            $params['startDate'] = $params['comparePeriod'][0];
            $params['endDate'] = $params['comparePeriod'][1];

            $previousMetrics = $service->getSourceReportData($params);

            $fluctuations = $service->calculateFluctuations(
                $currentMetrics, $previousMetrics
            );
        }

        return [
            'sourceReportData' => $currentMetrics,
            'fluctuations'     => $fluctuations,
        ];
    }
}

```
