mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-09 20:11:22 +00:00
Code optimizations.
This commit is contained in:
@@ -83,7 +83,8 @@ class BudgetController extends Controller
|
||||
*/
|
||||
public function budget(Budget $budget): JsonResponse
|
||||
{
|
||||
$start = $this->repository->firstUseDate($budget);
|
||||
/** @var Carbon $start */
|
||||
$start = $this->repository->firstUseDate($budget) ?? session('start', new Carbon);
|
||||
/** @var Carbon $end */
|
||||
$end = session('end', new Carbon);
|
||||
$cache = new CacheProperties();
|
||||
|
||||
@@ -274,8 +274,7 @@ class ReportController extends Controller
|
||||
$attributes['startDate'] = Carbon::createFromFormat('Ymd', $attributes['startDate']);
|
||||
} catch (InvalidArgumentException $e) {
|
||||
Log::debug(sprintf('Not important error message: %s', $e->getMessage()));
|
||||
$date = new Carbon;
|
||||
$date->startOfMonth();
|
||||
$date = Carbon::create()->startOfMonth();
|
||||
$attributes['startDate'] = $date;
|
||||
}
|
||||
|
||||
@@ -283,8 +282,7 @@ class ReportController extends Controller
|
||||
$attributes['endDate'] = Carbon::createFromFormat('Ymd', $attributes['endDate']);
|
||||
} catch (InvalidArgumentException $e) {
|
||||
Log::debug('Not important error message: %s', $e->getMessage());
|
||||
$date = new Carbon;
|
||||
$date->startOfMonth();
|
||||
$date = Carbon::create()->startOfMonth();
|
||||
$attributes['endDate'] = $date;
|
||||
}
|
||||
|
||||
|
||||
@@ -262,8 +262,7 @@ class TransactionController extends Controller
|
||||
{
|
||||
$range = app('preferences')->get('viewRange', '1M')->data;
|
||||
$first = $this->repository->firstNull();
|
||||
$start = new Carbon;
|
||||
$start->subYear();
|
||||
$start = Carbon::create()->subYear();
|
||||
$types = config('firefly.transactionTypesByWhat.' . $what);
|
||||
$entries = new Collection;
|
||||
if (null !== $first) {
|
||||
|
||||
@@ -124,8 +124,7 @@ class Range
|
||||
// ignore preference. set the range to be the current month:
|
||||
if (!app('session')->has('start') && !app('session')->has('end')) {
|
||||
$viewRange = app('preferences')->get('viewRange', '1M')->data;
|
||||
$start = new Carbon;
|
||||
$start = app('navigation')->updateStartDate($viewRange, $start);
|
||||
$start = app('navigation')->updateStartDate($viewRange, new Carbon);
|
||||
$end = app('navigation')->updateEndDate($viewRange, $start);
|
||||
|
||||
app('session')->put('start', $start);
|
||||
|
||||
@@ -149,8 +149,7 @@ class RecurrenceFormRequest extends Request
|
||||
public function rules(): array
|
||||
{
|
||||
$today = new Carbon;
|
||||
$tomorrow = clone $today;
|
||||
$tomorrow->addDay();
|
||||
$tomorrow = Carbon::create()->addDay();
|
||||
$rules = [
|
||||
// mandatory info for recurrence.
|
||||
'title' => 'required|between:1,255|uniqueObjectForUser:recurrences,title',
|
||||
|
||||
Reference in New Issue
Block a user