mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Add total_invoices calculation to DashboardController
This commit is contained in:
parent
8a8a7e2865
commit
8adc7716d2
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
*
|
*
|
||||||
@ -12,11 +13,20 @@
|
|||||||
namespace App\Http\Controllers\ClientPortal;
|
namespace App\Http\Controllers\ClientPortal;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Invoice;
|
||||||
|
|
||||||
class DashboardController extends Controller
|
class DashboardController extends Controller
|
||||||
{
|
{
|
||||||
public function index(): \Illuminate\View\View
|
public function index(): \Illuminate\View\View
|
||||||
{
|
{
|
||||||
return $this->render('dashboard.index');
|
$total_invoices = Invoice::withTrashed()
|
||||||
|
->where('client_id', auth()->guard('contact')->user()->client_id)
|
||||||
|
->where('is_deleted', 0)
|
||||||
|
->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL, Invoice::STATUS_PAID])
|
||||||
|
->sum('amount');
|
||||||
|
|
||||||
|
return $this->render('dashboard.index', [
|
||||||
|
'total_invoices' => $total_invoices,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user