mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-16 22:58:09 +00:00
Code cleanup.
This commit is contained in:
@@ -29,7 +29,6 @@ use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Repositories\Account\AccountTaskerInterface;
|
||||
use FireflyIII\Support\CacheProperties;
|
||||
use Illuminate\Support\Collection;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Class OperationsController.
|
||||
@@ -41,8 +40,6 @@ class OperationsController extends Controller
|
||||
|
||||
/**
|
||||
* OperationsController constructor.
|
||||
*
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -61,11 +58,8 @@ class OperationsController extends Controller
|
||||
/**
|
||||
* View of income and expense.
|
||||
*
|
||||
* @param Collection $accounts
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return mixed|string
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function expenses(Collection $accounts, Carbon $start, Carbon $end)
|
||||
@@ -81,12 +75,14 @@ class OperationsController extends Controller
|
||||
}
|
||||
$report = $this->tasker->getExpenseReport($start, $end, $accounts);
|
||||
$type = 'expense-entry';
|
||||
|
||||
try {
|
||||
$result = view('reports.partials.income-expenses', compact('report', 'type'))->render();
|
||||
} catch (Throwable $e) {
|
||||
} catch (\Throwable $e) {
|
||||
app('log')->error(sprintf('Could not render reports.partials.income-expense: %s', $e->getMessage()));
|
||||
app('log')->error($e->getTraceAsString());
|
||||
$result = 'Could not render view.';
|
||||
|
||||
throw new FireflyException($result, 0, $e);
|
||||
}
|
||||
|
||||
@@ -98,11 +94,6 @@ class OperationsController extends Controller
|
||||
/**
|
||||
* View of income.
|
||||
*
|
||||
* @param Collection $accounts
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function income(Collection $accounts, Carbon $start, Carbon $end): string
|
||||
@@ -118,12 +109,14 @@ class OperationsController extends Controller
|
||||
}
|
||||
$report = $this->tasker->getIncomeReport($start, $end, $accounts);
|
||||
$type = 'income-entry';
|
||||
|
||||
try {
|
||||
$result = view('reports.partials.income-expenses', compact('report', 'type'))->render();
|
||||
} catch (Throwable $e) {
|
||||
} catch (\Throwable $e) {
|
||||
app('log')->error(sprintf('Could not render reports.partials.income-expenses: %s', $e->getMessage()));
|
||||
app('log')->error($e->getTraceAsString());
|
||||
$result = 'Could not render view.';
|
||||
|
||||
throw new FireflyException($result, 0, $e);
|
||||
}
|
||||
|
||||
@@ -135,11 +128,8 @@ class OperationsController extends Controller
|
||||
/**
|
||||
* Overview of income and expense.
|
||||
*
|
||||
* @param Collection $accounts
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return mixed|string
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function operations(Collection $accounts, Carbon $start, Carbon $end)
|
||||
@@ -177,10 +167,11 @@ class OperationsController extends Controller
|
||||
|
||||
try {
|
||||
$result = view('reports.partials.operations', compact('sums'))->render();
|
||||
} catch (Throwable $e) {
|
||||
} catch (\Throwable $e) {
|
||||
app('log')->error(sprintf('Could not render reports.partials.operations: %s', $e->getMessage()));
|
||||
app('log')->error($e->getTraceAsString());
|
||||
$result = 'Could not render view.';
|
||||
|
||||
throw new FireflyException($result, 0, $e);
|
||||
}
|
||||
$cache->store($result);
|
||||
|
||||
Reference in New Issue
Block a user