mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-21 11:45:14 +00:00
Made big headway in preference management, accounts, importing stuff, etc. etc.
This commit is contained in:
@@ -1,19 +1,35 @@
|
||||
<?php
|
||||
use Carbon\Carbon as Carbon;
|
||||
use Firefly\Helper\Preferences\PreferencesHelperInterface as PHI;
|
||||
use Firefly\Storage\Account\AccountRepositoryInterface as ARI;
|
||||
|
||||
class HomeController extends BaseController {
|
||||
|
||||
public function __construct(ARI $accounts) {
|
||||
class HomeController extends BaseController
|
||||
{
|
||||
protected $accounts;
|
||||
protected $preferences;
|
||||
|
||||
public function __construct(ARI $accounts, PHI $preferences)
|
||||
{
|
||||
$this->accounts = $accounts;
|
||||
$this->preferences = $preferences;
|
||||
View::share('menu', 'home');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
// get list setting:
|
||||
$pref = $this->preferences->get('frontpageAccounts', []);
|
||||
|
||||
// get the accounts to display on the home screen:
|
||||
$count = $this->accounts->count();
|
||||
if ($pref->data == []) {
|
||||
$list = $this->accounts->getActiveDefault();
|
||||
} else {
|
||||
$list = $this->accounts->getByIds($pref->data);
|
||||
}
|
||||
|
||||
|
||||
// build the home screen:
|
||||
|
||||
return View::make('index')->with('count',$count);
|
||||
}
|
||||
return View::make('index')->with('count', $count)->with('accounts', $list);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user