mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fixed some initial startup bugs when working with Homestead.
This commit is contained in:
parent
e9afd55e9d
commit
9d4cba1620
@ -18,11 +18,15 @@ class GoogleChartController extends BaseController
|
|||||||
|
|
||||||
/** @var \FireflyIII\Shared\Preferences\Preferences $preferences */
|
/** @var \FireflyIII\Shared\Preferences\Preferences $preferences */
|
||||||
$preferences = App::make('FireflyIII\Shared\Preferences\Preferences');
|
$preferences = App::make('FireflyIII\Shared\Preferences\Preferences');
|
||||||
$pref = $preferences->get('frontpageAccounts');
|
$pref = $preferences->get('frontpageAccounts', []);
|
||||||
|
|
||||||
/** @var \FireflyIII\Database\Account $acct */
|
/** @var \FireflyIII\Database\Account $acct */
|
||||||
$acct = App::make('FireflyIII\Database\Account');
|
$acct = App::make('FireflyIII\Database\Account');
|
||||||
|
if (count($pref->data) > 0) {
|
||||||
$accounts = $acct->getByIds($pref->data);
|
$accounts = $acct->getByIds($pref->data);
|
||||||
|
} else {
|
||||||
|
$accounts = $acct->getAssetAccounts();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -169,7 +173,7 @@ class GoogleChartController extends BaseController
|
|||||||
foreach ($budgets as $budget) {
|
foreach ($budgets as $budget) {
|
||||||
$chart->addColumn($budget->name, 'number');
|
$chart->addColumn($budget->name, 'number');
|
||||||
}
|
}
|
||||||
$chart->addColumn('No budget','number');
|
$chart->addColumn('No budget', 'number');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Loop budgets this year.
|
* Loop budgets this year.
|
||||||
@ -179,7 +183,7 @@ class GoogleChartController extends BaseController
|
|||||||
while ($start <= $end) {
|
while ($start <= $end) {
|
||||||
$row = [clone $start];
|
$row = [clone $start];
|
||||||
|
|
||||||
foreach($budgets as $budget) {
|
foreach ($budgets as $budget) {
|
||||||
$row[] = $bdt->spentInMonth($budget, $start);
|
$row[] = $bdt->spentInMonth($budget, $start);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,14 +210,15 @@ class GoogleChartController extends BaseController
|
|||||||
*
|
*
|
||||||
* @return \Illuminate\Http\JsonResponse
|
* @return \Illuminate\Http\JsonResponse
|
||||||
*/
|
*/
|
||||||
public function componentsAndSpending(Component $component, $year) {
|
public function componentsAndSpending(Component $component, $year)
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
$start = new Carbon('01-01-' . $year);
|
$start = new Carbon('01-01-' . $year);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
App::abort(500);
|
App::abort(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($component->class == 'Budget') {
|
if ($component->class == 'Budget') {
|
||||||
/** @var \FireflyIII\Database\Budget $repos */
|
/** @var \FireflyIII\Database\Budget $repos */
|
||||||
$repos = App::make('FireflyIII\Database\Budget');
|
$repos = App::make('FireflyIII\Database\Budget');
|
||||||
} else {
|
} else {
|
||||||
@ -229,11 +234,11 @@ class GoogleChartController extends BaseController
|
|||||||
|
|
||||||
$end = clone $start;
|
$end = clone $start;
|
||||||
$end->endOfYear();
|
$end->endOfYear();
|
||||||
while($start <= $end) {
|
while ($start <= $end) {
|
||||||
|
|
||||||
$spent = $repos->spentInMonth($component, $start);
|
$spent = $repos->spentInMonth($component, $start);
|
||||||
$repetition = $repos->repetitionOnStartingOnDate($component, $start);
|
$repetition = $repos->repetitionOnStartingOnDate($component, $start);
|
||||||
if($repetition) {
|
if ($repetition) {
|
||||||
$budgeted = floatval($repetition->amount);
|
$budgeted = floatval($repetition->amount);
|
||||||
} else {
|
} else {
|
||||||
$budgeted = null;
|
$budgeted = null;
|
||||||
@ -245,7 +250,6 @@ class GoogleChartController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$chart->generate();
|
$chart->generate();
|
||||||
return Response::json($chart->getData());
|
return Response::json($chart->getData());
|
||||||
|
|
||||||
|
@ -37,11 +37,12 @@ $app = new Illuminate\Foundation\Application;
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$env = $app->detectEnvironment(array(
|
$env = $app->detectEnvironment(
|
||||||
|
[
|
||||||
'local' => array('homestead', 'SMJD*'),
|
'local' => ['SMJD*'],
|
||||||
|
'homestead' => ['homestead']
|
||||||
));
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user