mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-20 19:42:02 +00:00
More extensions and views. First home view is semi-complete, time to write some tests again.
This commit is contained in:
@@ -6,6 +6,8 @@ use Firefly\Storage\Account\AccountRepositoryInterface as ARI;
|
||||
class ChartController extends BaseController
|
||||
{
|
||||
|
||||
protected $accounts;
|
||||
|
||||
public function __construct(ARI $accounts)
|
||||
{
|
||||
$this->accounts = $accounts;
|
||||
@@ -14,7 +16,7 @@ class ChartController extends BaseController
|
||||
/**
|
||||
* Show home charts.
|
||||
*/
|
||||
public function home(Account $account = null)
|
||||
public function home($account = null)
|
||||
{
|
||||
// chart
|
||||
$chart = App::make('gchart');
|
||||
@@ -45,9 +47,13 @@ class ChartController extends BaseController
|
||||
$chart->addRowArray($row);
|
||||
}
|
||||
} else {
|
||||
$account = $this->accounts->find($account);
|
||||
if (is_null($account)) {
|
||||
return View::make('error')->with('message', 'No account found.');
|
||||
}
|
||||
$chart->addColumn($account->name, 'number');
|
||||
while ($current <= $today) {
|
||||
$row = [clone $current,$account->balance(clone $current)];
|
||||
$row = [clone $current, $account->balance(clone $current)];
|
||||
$current->addDay();
|
||||
$chart->addRowArray($row);
|
||||
}
|
||||
|
Reference in New Issue
Block a user