24 lines
606 B
PHP
24 lines
606 B
PHP
<?php
|
|
|
|
namespace App\Services\Api;
|
|
|
|
use App\Utils\TransactionUtil;
|
|
use Illuminate\Http\Request;
|
|
|
|
class ReportService
|
|
{
|
|
public function __construct(protected TransactionUtil $transactionUtil)
|
|
{
|
|
}
|
|
|
|
public function dashboardStats(int $business_id, Request $request): array
|
|
{
|
|
$location_id = $request->input('location_id');
|
|
|
|
return [
|
|
'total_sell' => $this->transactionUtil->getSellTotals($business_id, null, null, $location_id),
|
|
'total_purchase' => $this->transactionUtil->getPurchaseTotals($business_id, null, null, $location_id),
|
|
];
|
|
}
|
|
}
|