mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-19 02:52:44 +00:00
Make method nullable.
This commit is contained in:
@@ -145,7 +145,7 @@ class ShowController extends Controller
|
|||||||
}
|
}
|
||||||
$end = new Carbon;
|
$end = new Carbon;
|
||||||
$today = new Carbon;
|
$today = new Carbon;
|
||||||
$start = $this->repository->oldestJournalDate($account);
|
$start = $this->repository->oldestJournalDate($account) ?? Carbon::now()->startOfMonth();
|
||||||
$subTitleIcon = config('firefly.subIconsByIdentifier.' . $account->accountType->type);
|
$subTitleIcon = config('firefly.subIconsByIdentifier.' . $account->accountType->type);
|
||||||
$page = (int)$request->get('page');
|
$page = (int)$request->get('page');
|
||||||
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
|
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
|
||||||
@@ -190,7 +190,7 @@ class ShowController extends Controller
|
|||||||
private function getPeriodOverview(Account $account, ?Carbon $date): Collection
|
private function getPeriodOverview(Account $account, ?Carbon $date): Collection
|
||||||
{
|
{
|
||||||
$range = app('preferences')->get('viewRange', '1M')->data;
|
$range = app('preferences')->get('viewRange', '1M')->data;
|
||||||
$start = $this->repository->oldestJournalDate($account);
|
$start = $this->repository->oldestJournalDate($account) ?? Carbon::now()->startOfMonth();
|
||||||
$end = $date ?? new Carbon;
|
$end = $date ?? new Carbon;
|
||||||
if ($end < $start) {
|
if ($end < $start) {
|
||||||
[$start, $end] = [$end, $start]; // @codeCoverageIgnore
|
[$start, $end] = [$end, $start]; // @codeCoverageIgnore
|
||||||
|
@@ -166,7 +166,7 @@ class AccountController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function expenseBudgetAll(AccountRepositoryInterface $repository, Account $account): JsonResponse
|
public function expenseBudgetAll(AccountRepositoryInterface $repository, Account $account): JsonResponse
|
||||||
{
|
{
|
||||||
$start = $repository->oldestJournalDate($account);
|
$start = $repository->oldestJournalDate($account) ?? Carbon::now()->startOfMonth();
|
||||||
$end = Carbon::now();
|
$end = Carbon::now();
|
||||||
|
|
||||||
return $this->expenseBudget($account, $start, $end);
|
return $this->expenseBudget($account, $start, $end);
|
||||||
@@ -229,7 +229,7 @@ class AccountController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function expenseCategoryAll(AccountRepositoryInterface $repository, Account $account): JsonResponse
|
public function expenseCategoryAll(AccountRepositoryInterface $repository, Account $account): JsonResponse
|
||||||
{
|
{
|
||||||
$start = $repository->oldestJournalDate($account);
|
$start = $repository->oldestJournalDate($account) ?? Carbon::now()->startOfMonth();
|
||||||
$end = Carbon::now();
|
$end = Carbon::now();
|
||||||
|
|
||||||
return $this->expenseCategory($account, $start, $end);
|
return $this->expenseCategory($account, $start, $end);
|
||||||
@@ -320,7 +320,7 @@ class AccountController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function incomeCategoryAll(AccountRepositoryInterface $repository, Account $account): JsonResponse
|
public function incomeCategoryAll(AccountRepositoryInterface $repository, Account $account): JsonResponse
|
||||||
{
|
{
|
||||||
$start = $repository->oldestJournalDate($account);
|
$start = $repository->oldestJournalDate($account) ?? Carbon::now()->startOfMonth();
|
||||||
$end = Carbon::now();
|
$end = Carbon::now();
|
||||||
|
|
||||||
return $this->incomeCategory($account, $start, $end);
|
return $this->incomeCategory($account, $start, $end);
|
||||||
|
@@ -410,11 +410,11 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
*
|
*
|
||||||
* @param Account $account
|
* @param Account $account
|
||||||
*
|
*
|
||||||
* @return Carbon
|
* @return Carbon|null
|
||||||
*/
|
*/
|
||||||
public function oldestJournalDate(Account $account): Carbon
|
public function oldestJournalDate(Account $account): ?Carbon
|
||||||
{
|
{
|
||||||
$result = new Carbon;
|
$result = null;
|
||||||
$journal = $this->oldestJournal($account);
|
$journal = $this->oldestJournal($account);
|
||||||
if (null !== $journal) {
|
if (null !== $journal) {
|
||||||
$result = $journal->date;
|
$result = $journal->date;
|
||||||
|
@@ -184,9 +184,9 @@ interface AccountRepositoryInterface
|
|||||||
*
|
*
|
||||||
* @param Account $account
|
* @param Account $account
|
||||||
*
|
*
|
||||||
* @return Carbon
|
* @return Carbon|null
|
||||||
*/
|
*/
|
||||||
public function oldestJournalDate(Account $account): Carbon;
|
public function oldestJournalDate(Account $account): ?Carbon;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param User $user
|
* @param User $user
|
||||||
|
Reference in New Issue
Block a user