1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-11 05:32:39 +01:00
invoiceninja/app/Services/Chart/ChartService.php

49 lines
1.1 KiB
PHP
Raw Normal View History

2022-01-20 02:15:33 +01:00
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Services\Chart;
use App\Models\Company;
use App\Models\Expense;
use App\Models\Payment;
class ChartService
{
public Company $company;
public function __construct(Company $company)
{
$this->company = $company;
}
public function getCurrencyCodes()
{
$currencies = Payment::withTrashed()
->where('company_id', $this->company->id)
->where('is_deleted', 0)
->distinct()
->get(['currency_id']);
$expense_currencies = Expense::withTrashed()
->where('company_id', $this->company->id)
->where('is_deleted', 0)
->distinct()
->get(['expense_currency_id']);
$currencies = $currencies->merge($expense_currencies)->unique();
}
}