Various code cleanup.

This commit is contained in:
James Cole
2018-08-04 17:30:06 +02:00
parent 5af026674f
commit f0d3ca5d53
88 changed files with 552 additions and 311 deletions

View File

@@ -25,6 +25,8 @@ namespace FireflyIII\Generator\Report\Account;
use Carbon\Carbon;
use FireflyIII\Generator\Report\ReportGeneratorInterface;
use Illuminate\Support\Collection;
use Log;
use Throwable;
/**
* Class MonthReportGenerator.
@@ -44,7 +46,6 @@ class MonthReportGenerator implements ReportGeneratorInterface
* Generate the report.
*
* @return string
* @throws \Throwable
*/
public function generate(): string
{
@@ -52,11 +53,17 @@ class MonthReportGenerator implements ReportGeneratorInterface
$expenseIds = implode(',', $this->expense->pluck('id')->toArray());
$reportType = 'account';
$preferredPeriod = $this->preferredPeriod();
try {
$result = view(
'reports.account.report',
compact('accountIds', 'reportType', 'expenseIds', 'preferredPeriod')
)->with('start', $this->start)->with('end', $this->end)->render();
} catch (Throwable $e) {
Log::error(sprintf('Cannot render reports.account.report: %s', $e->getMessage()));
$result = 'Could not render report view.';
}
return view(
'reports.account.report',
compact('accountIds', 'reportType', 'expenseIds', 'preferredPeriod')
)->with('start', $this->start)->with('end', $this->end)->render();
return $result;
}
/**