mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
Add total_invoices calculation to DashboardController
This commit is contained in:
parent
8a8a7e2865
commit
8adc7716d2
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
@ -12,11 +13,20 @@
|
||||
namespace App\Http\Controllers\ClientPortal;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Invoice;
|
||||
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
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…
Reference in New Issue
Block a user