Code cleanup [skip-ci]

This commit is contained in:
James Cole 2014-07-15 22:16:29 +02:00
parent 473e0f81c9
commit d280767407
35 changed files with 469 additions and 128 deletions

View File

@ -2,9 +2,15 @@
use Firefly\Storage\Account\AccountRepositoryInterface as ARI;
/**
* Class AccountController
*/
class AccountController extends \BaseController
{
/**
* @param ARI $accounts
*/
public function __construct(ARI $accounts)
{
$this->accounts = $accounts;
@ -82,11 +88,11 @@ class AccountController extends \BaseController
/**
* Display the specified resource.
*
* @param int $id
* @param int $accountId
*
* @return Response
*/
public function show($id)
public function show($accountId)
{
}
@ -128,6 +134,4 @@ class AccountController extends \BaseController
// }
}

View File

@ -1,18 +1,21 @@
<?php
class BaseController extends Controller {
/**
* Class BaseController
*/
class BaseController extends Controller
{
/**
* Setup the layout used by the controller.
*
* @return void
*/
protected function setupLayout()
{
if ( ! is_null($this->layout))
{
$this->layout = View::make($this->layout);
}
}
/**
* Setup the layout used by the controller.
*
* @return void
*/
protected function setupLayout()
{
if (!is_null($this->layout)) {
$this->layout = View::make($this->layout);
}
}
}

View File

@ -4,36 +4,45 @@ use Firefly\Helper\Toolkit\Toolkit as tk;
use Firefly\Storage\Account\AccountRepositoryInterface as ARI;
use Firefly\Storage\TransactionJournal\TransactionJournalRepositoryInterface as TJRI;
/**
* Class ChartController
*/
class ChartController extends BaseController
{
protected $accounts;
protected $journals;
protected $_accounts;
protected $_journals;
/**
* @param ARI $accounts
* @param TJRI $journals
*/
public function __construct(ARI $accounts, TJRI $journals)
{
$this->accounts = $accounts;
$this->journals = $journals;
$this->_accounts = $accounts;
$this->_journals = $journals;
}
/**
* Show home charts.
* @param null $accountId
*
* @return \Illuminate\Http\JsonResponse
*/
public function homeAccount($id = null)
public function homeAccount($accountId = null)
{
list($start, $end) = tk::getDateRange();
$current = clone $start;
$return = [];
$account = null;
if(!is_null($id)) {
$account = $this->accounts->find($id);
if (!is_null($accountId)) {
$account = $this->_accounts->find($accountId);
}
if (is_null($account)) {
$accounts = $this->accounts->getActiveDefault();
$accounts = $this->_accounts->getActiveDefault();
foreach ($accounts as $index => $account) {
foreach ($accounts as $account) {
$return[] = ['name' => $account->name, 'data' => []];
}
while ($current <= $end) {
@ -69,7 +78,7 @@ class ChartController extends BaseController
'data' => []
];
$result = $this->journals->homeBudgetChart($start, $end);
$result = $this->_journals->homeBudgetChart($start, $end);
foreach ($result as $name => $amount) {
$data['data'][] = [$name, $amount];
@ -85,7 +94,7 @@ class ChartController extends BaseController
{
list($start, $end) = tk::getDateRange();
$result = $this->journals->homeCategoryChart($start, $end);
$result = $this->_journals->homeCategoryChart($start, $end);
$data = [
'type' => 'pie',
'name' => 'Amount: ',
@ -111,7 +120,7 @@ class ChartController extends BaseController
'data' => []
];
$result = $this->journals->homeBeneficiaryChart($start, $end);
$result = $this->_journals->homeBeneficiaryChart($start, $end);
foreach ($result as $name => $amount) {
$data['data'][] = [$name, $amount];

View File

@ -1,7 +1,10 @@
<?php
class ComponentsController extends BaseController {
/**
* Class ComponentsController
*/
class ComponentsController extends BaseController
{
}
}

View File

@ -3,37 +3,47 @@ use Firefly\Helper\Preferences\PreferencesHelperInterface as PHI;
use Firefly\Storage\Account\AccountRepositoryInterface as ARI;
use Firefly\Storage\TransactionJournal\TransactionJournalRepositoryInterface as TJRI;
/**
* Class HomeController
*/
class HomeController extends BaseController
{
protected $accounts;
protected $preferences;
protected $tj;
protected $_accounts;
protected $_preferences;
protected $_journal;
public function __construct(ARI $accounts, PHI $preferences, TJRI $tj)
/**
* @param ARI $accounts
* @param PHI $preferences
* @param TJRI $journal
*/
public function __construct(ARI $accounts, PHI $preferences, TJRI $journal)
{
$this->accounts = $accounts;
$this->preferences = $preferences;
$this->tj = $tj;
$this->_accounts = $accounts;
$this->_preferences = $preferences;
$this->_journal = $journal;
View::share('menu', 'home');
}
/**
* @return $this|\Illuminate\View\View
*/
public function index()
{
// get list setting:
$pref = $this->preferences->get('frontpageAccounts', []);
$pref = $this->_preferences->get('frontpageAccounts', []);
// get the accounts to display on the home screen:
$count = $this->accounts->count();
$count = $this->_accounts->count();
if ($pref->data == []) {
$list = $this->accounts->getActiveDefault();
$list = $this->_accounts->getActiveDefault();
} else {
$list = $this->accounts->getByIds($pref->data);
$list = $this->_accounts->getByIds($pref->data);
}
// get transactions for each account:
foreach ($list as $account) {
$account->transactionList = $this->tj->getByAccount($account,10);
$account->transactionList = $this->_journal->getByAccount($account, 10);
}

View File

@ -5,19 +5,28 @@ use Firefly\Storage\Budget\BudgetRepositoryInterface as Bud;
use Firefly\Storage\Category\CategoryRepositoryInterface as Cat;
use Firefly\Storage\Component\ComponentRepositoryInterface as CRI;
/**
* Class JsonController
*/
class JsonController extends BaseController
{
protected $accounts;
protected $components;
protected $categories;
protected $budgets;
protected $_accounts;
protected $_components;
protected $_categories;
protected $_budgets;
/**
* @param ARI $accounts
* @param CRI $components
* @param Cat $categories
* @param Bud $budgets
*/
public function __construct(ARI $accounts, CRI $components, Cat $categories, Bud $budgets)
{
$this->components = $components;
$this->accounts = $accounts;
$this->categories = $categories;
$this->budgets = $budgets;
$this->_components = $components;
$this->_accounts = $accounts;
$this->_categories = $categories;
$this->_budgets = $budgets;
}
/**
@ -25,7 +34,7 @@ class JsonController extends BaseController
*/
public function beneficiaries()
{
$list = $this->accounts->getBeneficiaries();
$list = $this->_accounts->getBeneficiaries();
$return = [];
foreach ($list as $entry) {
$return[] = $entry->name;
@ -40,7 +49,7 @@ class JsonController extends BaseController
*/
public function categories()
{
$list = $this->categories->get();
$list = $this->_categories->get();
$return = [];
foreach ($list as $entry) {
$return[] = $entry->name;

View File

@ -2,21 +2,33 @@
use Firefly\Helper\Migration\MigrationHelperInterface as MHI;
/**
* Class MigrationController
*/
class MigrationController extends BaseController
{
protected $migration;
protected $_migration;
/**
* @param MHI $migration
*/
public function __construct(MHI $migration)
{
$this->migration = $migration;
$this->_migration = $migration;
View::share('menu', 'home');
}
public function dev() {
/**
* Dev method
*/
public function dev()
{
$file = Config::get('dev.import');
if(file_exists($file)) {
if (file_exists($file)) {
$user = User::find(1);
/** @noinspection PhpParamsInspection */
Auth::login($user);
/** @var Firefly\Helper\Migration\MigrationHelperInterface $migration */
$migration = App::make('Firefly\Helper\Migration\MigrationHelperInterface');
@ -27,11 +39,17 @@ class MigrationController extends BaseController
}
}
/**
* @return \Illuminate\View\View
*/
public function index()
{
return View::make('migrate.index');
}
/**
* @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\View\View
*/
public function postIndex()
{
if (Input::hasFile('exportFile')) {
@ -40,12 +58,12 @@ class MigrationController extends BaseController
$file = Input::file('exportFile');
$path = $file->getRealPath();
$this->migration->loadFile($path);
$this->_migration->loadFile($path);
if (!$this->migration->validFile()) {
if (!$this->_migration->validFile()) {
return View::make('error')->with('message', 'Invalid JSON content.');
}
$this->migration->migrate();
$this->_migration->migrate();
return Redirect::route('index');
} else {
return View::make('error')->with('message', 'No file selected');

View File

@ -3,43 +3,57 @@
use Firefly\Helper\Preferences\PreferencesHelperInterface as PHI;
use Firefly\Storage\Account\AccountRepositoryInterface as ARI;
/**
* Class PreferencesController
*/
class PreferencesController extends BaseController
{
protected $accounts;
protected $preferences;
protected $_accounts;
protected $_preferences;
/**
* @param ARI $accounts
* @param PHI $preferences
*/
public function __construct(ARI $accounts, PHI $preferences)
{
$this->accounts = $accounts;
$this->preferences = $preferences;
$this->_accounts = $accounts;
$this->_preferences = $preferences;
View::share('menu', 'home');
}
/**
* @return $this|\Illuminate\View\View
*/
public function index()
{
$accounts = $this->accounts->getDefault();
$accounts = $this->_accounts->getDefault();
$viewRange = $this->preferences->get('viewRange','1M');
$viewRange = $this->_preferences->get('viewRange', '1M');
$viewRangeValue = $viewRange->data;
// pref:
$frontpage = $this->preferences->get('frontpageAccounts', []);
return View::make('preferences.index')->with('accounts', $accounts)->with('frontpageAccounts', $frontpage)->with('viewRange',$viewRangeValue);
$frontpage = $this->_preferences->get('frontpageAccounts', []);
return View::make('preferences.index')->with('accounts', $accounts)->with('frontpageAccounts', $frontpage)
->with('viewRange', $viewRangeValue);
}
/**
* @return \Illuminate\Http\RedirectResponse
*/
public function postIndex()
{
// frontpage accounts
$frontpageAccounts = [];
foreach(Input::get('frontpageAccounts') as $id) {
foreach (Input::get('frontpageAccounts') as $id) {
$frontpageAccounts[] = intval($id);
}
$this->preferences->set('frontpageAccounts',$frontpageAccounts);
$this->_preferences->set('frontpageAccounts', $frontpageAccounts);
// view range:
$this->preferences->set('viewRange',Input::get('viewRange'));
$this->_preferences->set('viewRange', Input::get('viewRange'));
// forget session values:
Session::forget('start');
Session::forget('end');

View File

@ -2,24 +2,41 @@
use Firefly\Storage\User\UserRepositoryInterface as URI;
/**
* Class ProfileController
*/
class ProfileController extends BaseController
{
public function __construct(URI $user) {
/**
* @param URI $user
*/
public function __construct(URI $user)
{
$this->user = $user;
View::share('menu', 'home');
}
/**
* @return \Illuminate\View\View
*
*/
public function index()
{
return View::make('profile.index');
}
/**
* @return \Illuminate\View\View
*/
public function changePassword()
{
return View::make('profile.change-password');
}
/**
* @return \Illuminate\Http\RedirectResponse|\Illuminate\View\View
*/
public function postChangePassword()
{
@ -44,7 +61,8 @@ class ProfileController extends BaseController
}
// update the user with the new password.
$this->user->updatePassword(Auth::user(),Input::get('new1'));
/** @noinspection PhpParamsInspection */
$this->user->updatePassword(Auth::user(), Input::get('new1'));
Session::flash('success', 'Password changed!');
return Redirect::route('profile');

View File

@ -6,44 +6,59 @@ use Firefly\Storage\Budget\BudgetRepositoryInterface as Bud;
use Firefly\Storage\Category\CategoryRepositoryInterface as Cat;
use Firefly\Storage\TransactionJournal\TransactionJournalRepositoryInterface as TJRI;
/**
* Class TransactionController
*/
class TransactionController extends BaseController
{
protected $accounts;
protected $budgets;
protected $categories;
protected $tj;
protected $_accounts;
protected $_budgets;
protected $_categories;
protected $_journal;
public function __construct(ARI $accounts, Bud $budgets, Cat $categories, TJRI $tj)
/**
* @param ARI $accounts
* @param Bud $budgets
* @param Cat $categories
* @param TJRI $journal
*/
public function __construct(ARI $accounts, Bud $budgets, Cat $categories, TJRI $journal)
{
$this->accounts = $accounts;
$this->budgets = $budgets;
$this->categories = $categories;
$this->tj = $tj;
$this->_accounts = $accounts;
$this->_budgets = $budgets;
$this->_categories = $categories;
$this->_journal = $journal;
View::share('menu', 'home');
}
/**
* @return $this|\Illuminate\View\View
*/
public function createWithdrawal()
{
// get accounts with names and id's.
$accounts = $this->accounts->getActiveDefaultAsSelectList();
$accounts = $this->_accounts->getActiveDefaultAsSelectList();
$budgets = $this->budgets->getAsSelectList();
$budgets = $this->_budgets->getAsSelectList();
$budgets[0] = '(no budget)';
return View::make('transactions.withdrawal')->with('accounts', $accounts)->with('budgets', $budgets);
}
/**
* @return $this|\Illuminate\View\View
*/
public function createDeposit()
{
// get accounts with names and id's.
$accounts = $this->accounts->getActiveDefaultAsSelectList();
$accounts = $this->_accounts->getActiveDefaultAsSelectList();
$budgets = $this->budgets->getAsSelectList();
$budgets = $this->_budgets->getAsSelectList();
$budgets[0] = '(no budget)';
@ -51,12 +66,15 @@ class TransactionController extends BaseController
}
/**
* @return $this|\Illuminate\View\View
*/
public function createTransfer()
{
// get accounts with names and id's.
$accounts = $this->accounts->getActiveDefaultAsSelectList();
$accounts = $this->_accounts->getActiveDefaultAsSelectList();
$budgets = $this->budgets->getAsSelectList();
$budgets = $this->_budgets->getAsSelectList();
$budgets[0] = '(no budget)';
@ -64,25 +82,28 @@ class TransactionController extends BaseController
}
/**
* @return \Illuminate\Http\RedirectResponse
*/
public function postCreateWithdrawal()
{
// create or find beneficiary:
$beneficiary = $this->accounts->createOrFindBeneficiary(Input::get('beneficiary'));
$beneficiary = $this->_accounts->createOrFindBeneficiary(Input::get('beneficiary'));
// fall back to cash account if empty:
if (is_null($beneficiary)) {
$beneficiary = $this->accounts->getCashAccount();
$beneficiary = $this->_accounts->getCashAccount();
}
// create or find category:
$category = $this->categories->createOrFind(Input::get('category'));
$category = $this->_categories->createOrFind(Input::get('category'));
// find budget:
$budget = $this->budgets->find(intval(Input::get('budget_id')));
$budget = $this->_budgets->find(intval(Input::get('budget_id')));
// find account:
$account = $this->accounts->find(intval(Input::get('account_id')));
$account = $this->_accounts->find(intval(Input::get('account_id')));
// find amount & description:
$description = trim(Input::get('description'));
@ -92,7 +113,7 @@ class TransactionController extends BaseController
// create journal
/** @var \TransactionJournal $journal */
try {
$journal = $this->tj->createSimpleJournal($account, $beneficiary, $description, $amount, $date);
$journal = $this->_journal->createSimpleJournal($account, $beneficiary, $description, $amount, $date);
} catch (\Firefly\Exception\FireflyException $e) {
return Redirect::route('transactions.withdrawal')->withInput();
}
@ -109,21 +130,24 @@ class TransactionController extends BaseController
return Redirect::route('index');
}
/**
* @return \Illuminate\Http\RedirectResponse
*/
public function postCreateDeposit()
{
// create or find beneficiary:
$beneficiary = $this->accounts->createOrFindBeneficiary(Input::get('beneficiary'));
$beneficiary = $this->_accounts->createOrFindBeneficiary(Input::get('beneficiary'));
// fall back to cash account if empty:
if (is_null($beneficiary)) {
$beneficiary = $this->accounts->getCashAccount();
$beneficiary = $this->_accounts->getCashAccount();
}
// create or find category:
$category = $this->categories->createOrFind(Input::get('category'));
$category = $this->_categories->createOrFind(Input::get('category'));
// find account:
$account = $this->accounts->find(intval(Input::get('account_id')));
$account = $this->_accounts->find(intval(Input::get('account_id')));
// find amount & description:
$description = trim(Input::get('description'));
@ -133,7 +157,7 @@ class TransactionController extends BaseController
// create journal
/** @var \TransactionJournal $journal */
try {
$journal = $this->tj->createSimpleJournal($beneficiary, $account, $description, $amount, $date);
$journal = $this->_journal->createSimpleJournal($beneficiary, $account, $description, $amount, $date);
} catch (\Firefly\Exception\FireflyException $e) {
return Redirect::route('transactions.deposit')->withInput();
}
@ -146,16 +170,19 @@ class TransactionController extends BaseController
return Redirect::route('index');
}
/**
* @return \Illuminate\Http\RedirectResponse
*/
public function postCreateTransfer()
{
// create or find category:
$category = $this->categories->createOrFind(Input::get('category'));
$category = $this->_categories->createOrFind(Input::get('category'));
// find account to:
$to = $this->accounts->find(intval(Input::get('account_to_id')));
$toAccount = $this->_accounts->find(intval(Input::get('account_to_id')));
// find account from
$from = $this->accounts->find(intval(Input::get('account_from_id')));
$from = $this->_accounts->find(intval(Input::get('account_from_id')));
// find amount & description:
$description = trim(Input::get('description'));
@ -165,7 +192,7 @@ class TransactionController extends BaseController
// create journal
/** @var \TransactionJournal $journal */
try {
$journal = $this->tj->createSimpleJournal($from, $to, $description, $amount, $date);
$journal = $this->_journal->createSimpleJournal($from, $toAccount, $description, $amount, $date);
} catch (\Firefly\Exception\FireflyException $e) {
return Redirect::route('transactions.transfer')->withInput();
}

View File

@ -3,6 +3,9 @@
use Firefly\Helper\Email\EmailHelperInterface as EHI;
use Firefly\Storage\User\UserRepositoryInterface as URI;
/**
* Class UserController
*/
class UserController extends BaseController
{

View File

@ -3,6 +3,7 @@
namespace Firefly\Exception;
class FireflyException extends \Exception {
class FireflyException extends \Exception
{
}

View File

@ -3,6 +3,7 @@
namespace Firefly\Helper;
class MigrationException extends \Exception {
class MigrationException extends \Exception
{
}

View File

@ -2,10 +2,13 @@
namespace Firefly\Helper\Email;
interface EmailHelperInterface {
interface EmailHelperInterface
{
public function sendVerificationMail(\User $user);
public function sendPasswordMail(\User $user);
public function sendResetVerification(\User $user);
}

View File

@ -192,11 +192,11 @@ class MigrationHelper implements MigrationHelperInterface
$journal = $journals->createSimpleJournal($fromAccount, $toAccount, $entry->description, $amount, $date);
// save budgets and categories, on the journal
if(isset($budgets[$entry->id])) {
if (isset($budgets[$entry->id])) {
$budget = $budgets[$entry->id];
$journal->budgets()->save($budget);
}
if(isset($categories[$entry->id])) {
if (isset($categories[$entry->id])) {
$category = $categories[$entry->id];
$journal->categories()->save($category);
}

View File

@ -3,7 +3,8 @@ namespace Firefly\Helper\Preferences;
interface PreferencesHelperInterface
{
public function set($name,$value);
public function get($name,$default = null);
public function set($name, $value);
public function get($name, $default = null);
}

View File

@ -3,7 +3,8 @@
namespace Firefly\Helper\Toolkit;
interface ToolkitInterface {
interface ToolkitInterface
{
public static function getDateRange();
}

View File

@ -156,8 +156,8 @@ class EloquentAccountRepository implements AccountRepositoryInterface
public function getCashAccount()
{
$type = \AccountType::where('description','Cash account')->first();
$cash = \Auth::user()->accounts()->where('account_type_id',$type->id)->first();
$type = \AccountType::where('description', 'Cash account')->first();
$cash = \Auth::user()->accounts()->where('account_type_id', $type->id)->first();
return $cash;
}

View File

@ -6,6 +6,7 @@ namespace Firefly\Storage\Budget;
interface BudgetRepositoryInterface
{
public function getAsSelectList();
public function find($id);
}

View File

@ -17,12 +17,12 @@ class EloquentComponentRepository implements ComponentRepositoryInterface
}
public function get() {
public function get()
{
die('no impl');
}
public function store($data)
{
if (!isset($data['class'])) {

View File

@ -20,7 +20,6 @@ class StorageServiceProvider extends ServiceProvider
);
$this->app->bind(
'Firefly\Storage\Account\AccountRepositoryInterface',
'Firefly\Storage\Account\EloquentAccountRepository'

View File

@ -3,6 +3,7 @@
namespace Firefly\Storage\Transaction;
class EloquentTransactionRepository implements TransactionRepositoryInterface {
class EloquentTransactionRepository implements TransactionRepositoryInterface
{
}

View File

@ -38,15 +38,15 @@ class EloquentTransactionJournalRepository implements TransactionJournalReposito
$amountFrom = $amount * -1;
$amountTo = $amount;
if(round(floatval($amount),2) == 0.00) {
if (round(floatval($amount), 2) == 0.00) {
\Log::error('Transaction will never save: amount = 0');
\Session::flash('error','The amount should not be empty or zero.');
\Session::flash('error', 'The amount should not be empty or zero.');
throw new \Firefly\Exception\FireflyException('Could not figure out transaction type.');
}
// same account:
if($from->id == $to->id) {
if ($from->id == $to->id) {
\Log::error('Accounts cannot be equal');
\Session::flash('error','Select two different accounts.');
\Session::flash('error', 'Select two different accounts.');
throw new \Firefly\Exception\FireflyException('Select two different accounts.');
}
@ -108,7 +108,7 @@ class EloquentTransactionJournalRepository implements TransactionJournalReposito
if (!$journal->save()) {
\Log::error('Cannot create valid journal.');
\Log::error('Errors: ' . print_r($journal->errors()->all(), true));
\Session::flash('error','Could not create journal: ' . $journal->errors()->first());
\Session::flash('error', 'Could not create journal: ' . $journal->errors()->first());
throw new \Firefly\Exception\FireflyException('Cannot create valid journal.');
}
$journal->save();
@ -173,7 +173,7 @@ class EloquentTransactionJournalRepository implements TransactionJournalReposito
}]
)
->after($start)->before($end)
->where('completed',1)
->where('completed', 1)
->whereIn('transaction_type_id', $types)
->get(['transaction_journals.*']);
unset($types);
@ -182,8 +182,9 @@ class EloquentTransactionJournalRepository implements TransactionJournalReposito
foreach ($journals as $journal) {
// has to be one:
if(!isset($journal->transactions[0])) {
throw new FireflyException('Journal #'.$journal->id.' has ' . count($journal->transactions).' transactions!');
if (!isset($journal->transactions[0])) {
throw new FireflyException('Journal #' . $journal->id . ' has ' . count($journal->transactions)
. ' transactions!');
}
$transaction = $journal->transactions[0];
$amount = floatval($transaction->amount);

View File

@ -12,7 +12,9 @@ interface TransactionJournalRepositoryInterface
public function getByAccount(\Account $account, $count = 25);
public function homeBudgetChart(\Carbon\Carbon $start, \Carbon\Carbon $end);
public function homeCategoryChart(\Carbon\Carbon $start, \Carbon\Carbon $end);
public function homeBeneficiaryChart(\Carbon\Carbon $start, \Carbon\Carbon $end);
public function homeComponentChart(\Carbon\Carbon $start, \Carbon\Carbon $end, $chartType);

View File

@ -1,6 +1,27 @@
<?php
use LaravelBook\Ardent\Ardent as Ardent;
/**
* Account
*
* @property integer $id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property integer $user_id
* @property integer $account_type_id
* @property string $name
* @property boolean $active
* @property-read \AccountType $accountType
* @property-read \User $user
* @property-read \Illuminate\Database\Eloquent\Collection|\Transaction[] $transactions
* @method static \Illuminate\Database\Query\Builder|\Account whereId($value)
* @method static \Illuminate\Database\Query\Builder|\Account whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\Account whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\Account whereUserId($value)
* @method static \Illuminate\Database\Query\Builder|\Account whereAccountTypeId($value)
* @method static \Illuminate\Database\Query\Builder|\Account whereName($value)
* @method static \Illuminate\Database\Query\Builder|\Account whereActive($value)
*/
class Account extends Ardent
{

View File

@ -1,6 +1,19 @@
<?php
/**
* AccountType
*
* @property integer $id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property string $description
* @property-read \Illuminate\Database\Eloquent\Collection|\Account[] $accounts
* @method static \Illuminate\Database\Query\Builder|\AccountType whereId($value)
* @method static \Illuminate\Database\Query\Builder|\AccountType whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\AccountType whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\AccountType whereDescription($value)
*/
class AccountType extends Eloquent
{

View File

@ -1,5 +1,24 @@
<?php
/**
* Budget
*
* @property integer $id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property string $name
* @property integer $user_id
* @property string $class
* @property-read \Illuminate\Database\Eloquent\Collection|\Transaction[] $transactions
* @property-read \Illuminate\Database\Eloquent\Collection|\TransactionJournal[] $transactionjournals
* @property-read \User $user
* @method static \Illuminate\Database\Query\Builder|\Budget whereId($value)
* @method static \Illuminate\Database\Query\Builder|\Budget whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\Budget whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\Budget whereName($value)
* @method static \Illuminate\Database\Query\Builder|\Budget whereUserId($value)
* @method static \Illuminate\Database\Query\Builder|\Budget whereClass($value)
*/
class Budget extends Component {
protected $isSubclass = true;

View File

@ -1,5 +1,24 @@
<?php
/**
* Category
*
* @property integer $id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property string $name
* @property integer $user_id
* @property string $class
* @property-read \Illuminate\Database\Eloquent\Collection|\Transaction[] $transactions
* @property-read \Illuminate\Database\Eloquent\Collection|\TransactionJournal[] $transactionjournals
* @property-read \User $user
* @method static \Illuminate\Database\Query\Builder|\Category whereId($value)
* @method static \Illuminate\Database\Query\Builder|\Category whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\Category whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\Category whereName($value)
* @method static \Illuminate\Database\Query\Builder|\Category whereUserId($value)
* @method static \Illuminate\Database\Query\Builder|\Category whereClass($value)
*/
class Category extends Component
{
protected $isSubclass = true;

View File

@ -1,6 +1,25 @@
<?php
/**
* Component
*
* @property integer $id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property string $name
* @property integer $user_id
* @property string $class
* @property-read \Illuminate\Database\Eloquent\Collection|\Transaction[] $transactions
* @property-read \Illuminate\Database\Eloquent\Collection|\TransactionJournal[] $transactionjournals
* @property-read \User $user
* @method static \Illuminate\Database\Query\Builder|\Component whereId($value)
* @method static \Illuminate\Database\Query\Builder|\Component whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\Component whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\Component whereName($value)
* @method static \Illuminate\Database\Query\Builder|\Component whereUserId($value)
* @method static \Illuminate\Database\Query\Builder|\Component whereClass($value)
*/
class Component extends Firefly\Database\SingleTableInheritanceEntity
{

View File

@ -3,6 +3,23 @@
use LaravelBook\Ardent\Ardent;
/**
* Preference
*
* @property integer $id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property integer $user_id
* @property string $name
* @property string $data
* @property-read \User $user
* @method static \Illuminate\Database\Query\Builder|\Preference whereId($value)
* @method static \Illuminate\Database\Query\Builder|\Preference whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\Preference whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\Preference whereUserId($value)
* @method static \Illuminate\Database\Query\Builder|\Preference whereName($value)
* @method static \Illuminate\Database\Query\Builder|\Preference whereData($value)
*/
class Preference extends Ardent
{
public static $rules

View File

@ -3,6 +3,29 @@
use LaravelBook\Ardent\Ardent;
/**
* Transaction
*
* @property integer $id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property integer $account_id
* @property integer $transaction_journal_id
* @property string $description
* @property float $amount
* @property-read \Account $account
* @property-read \TransactionJournal $transactionJournal
* @property-read \Illuminate\Database\Eloquent\Collection|\Component[] $components
* @property-read \Illuminate\Database\Eloquent\Collection|\Budget[] $budgets
* @property-read \Illuminate\Database\Eloquent\Collection|\Category[] $categories
* @method static \Illuminate\Database\Query\Builder|\Transaction whereId($value)
* @method static \Illuminate\Database\Query\Builder|\Transaction whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\Transaction whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\Transaction whereAccountId($value)
* @method static \Illuminate\Database\Query\Builder|\Transaction whereTransactionJournalId($value)
* @method static \Illuminate\Database\Query\Builder|\Transaction whereDescription($value)
* @method static \Illuminate\Database\Query\Builder|\Transaction whereAmount($value)
*/
class Transaction extends Ardent
{
public static $rules

View File

@ -1,6 +1,19 @@
<?php
/**
* TransactionCurrency
*
* @property integer $id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property string $code
* @property-read \Illuminate\Database\Eloquent\Collection|\TransactionJournal[] $transactionJournals
* @method static \Illuminate\Database\Query\Builder|\TransactionCurrency whereId($value)
* @method static \Illuminate\Database\Query\Builder|\TransactionCurrency whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\TransactionCurrency whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\TransactionCurrency whereCode($value)
*/
class TransactionCurrency extends Eloquent
{

View File

@ -3,6 +3,36 @@
use LaravelBook\Ardent\Ardent;
/**
* TransactionJournal
*
* @property integer $id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property integer $transaction_type_id
* @property integer $transaction_currency_id
* @property string $description
* @property boolean $completed
* @property \Carbon\Carbon $date
* @property-read \TransactionType $transactionType
* @property-read \TransactionCurrency $transactionCurrency
* @property-read \Illuminate\Database\Eloquent\Collection|\Transaction[] $transactions
* @property-read \Illuminate\Database\Eloquent\Collection|\Component[] $components
* @property-read \Illuminate\Database\Eloquent\Collection|\
* 'Budget[] $budgets
* @property-read \Illuminate\Database\Eloquent\Collection|\
* 'Category[] $categories
* @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereId($value)
* @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereTransactionTypeId($value)
* @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereTransactionCurrencyId($value)
* @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereDescription($value)
* @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereCompleted($value)
* @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereDate($value)
* @method static \TransactionJournal after($date)
* @method static \TransactionJournal before($date)
*/
class TransactionJournal extends Ardent
{

View File

@ -1,6 +1,19 @@
<?php
/**
* TransactionType
*
* @property integer $id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property string $type
* @property-read \Illuminate\Database\Eloquent\Collection|\TransactionJournal[] $transactionJournals
* @method static \Illuminate\Database\Query\Builder|\TransactionType whereId($value)
* @method static \Illuminate\Database\Query\Builder|\TransactionType whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\TransactionType whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\TransactionType whereType($value)
*/
class TransactionType extends Eloquent {
public function transactionJournals() {
return $this->hasMany('TransactionJournal');

View File

@ -7,6 +7,31 @@ use Illuminate\Auth\UserTrait;
use LaravelBook\Ardent\Ardent;
/**
* User
*
* @property integer $id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property string $email
* @property string $password
* @property string $reset
* @property string $remember_token
* @property boolean $migrated
* @property-read \Illuminate\Database\Eloquent\Collection|\Account[] $accounts
* @property-read \Illuminate\Database\Eloquent\Collection|\Preference[] $preferences
* @property-read \Illuminate\Database\Eloquent\Collection|\Component[] $components
* @property-read \Illuminate\Database\Eloquent\Collection|\Budget[] $budgets
* @property-read \Illuminate\Database\Eloquent\Collection|\Category[] $categories
* @method static \Illuminate\Database\Query\Builder|\User whereId($value)
* @method static \Illuminate\Database\Query\Builder|\User whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\User whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\User whereEmail($value)
* @method static \Illuminate\Database\Query\Builder|\User wherePassword($value)
* @method static \Illuminate\Database\Query\Builder|\User whereReset($value)
* @method static \Illuminate\Database\Query\Builder|\User whereRememberToken($value)
* @method static \Illuminate\Database\Query\Builder|\User whereMigrated($value)
*/
class User extends Ardent implements UserInterface, RemindableInterface
{