mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
A giant rename action in preparation of v3.2.2
This commit is contained in:
parent
335279e728
commit
7a9df05f6b
@ -147,20 +147,20 @@ Breadcrumbs::register(
|
||||
);
|
||||
|
||||
Breadcrumbs::register(
|
||||
'piggyBanks.edit', function (Generator $breadcrumbs, Piggybank $piggyBank) {
|
||||
'piggyBanks.edit', function (Generator $breadcrumbs, PiggyBank $piggyBank) {
|
||||
$breadcrumbs->parent('piggyBanks.show', $piggyBank);
|
||||
$breadcrumbs->push('Edit ' . $piggyBank->name, route('piggyBanks.edit', $piggyBank->id));
|
||||
}
|
||||
);
|
||||
Breadcrumbs::register(
|
||||
'piggyBanks.delete', function (Generator $breadcrumbs, Piggybank $piggyBank) {
|
||||
'piggyBanks.delete', function (Generator $breadcrumbs, PiggyBank $piggyBank) {
|
||||
$breadcrumbs->parent('piggyBanks.show', $piggyBank);
|
||||
$breadcrumbs->push('Delete ' . $piggyBank->name, route('piggyBanks.delete', $piggyBank->id));
|
||||
}
|
||||
);
|
||||
|
||||
Breadcrumbs::register(
|
||||
'piggyBanks.show', function (Generator $breadcrumbs, Piggybank $piggyBank) {
|
||||
'piggyBanks.show', function (Generator $breadcrumbs, PiggyBank $piggyBank) {
|
||||
$breadcrumbs->parent('piggyBanks.index');
|
||||
$breadcrumbs->push($piggyBank->name, route('piggyBanks.show', $piggyBank->id));
|
||||
|
||||
@ -251,20 +251,20 @@ Breadcrumbs::register(
|
||||
);
|
||||
|
||||
Breadcrumbs::register(
|
||||
'repeated.edit', function (Generator $breadcrumbs, Piggybank $piggyBank) {
|
||||
'repeated.edit', function (Generator $breadcrumbs, PiggyBank $piggyBank) {
|
||||
$breadcrumbs->parent('repeated.show', $piggyBank);
|
||||
$breadcrumbs->push('Edit ' . $piggyBank->name, route('repeated.edit', $piggyBank->id));
|
||||
}
|
||||
);
|
||||
Breadcrumbs::register(
|
||||
'repeated.delete', function (Generator $breadcrumbs, Piggybank $piggyBank) {
|
||||
'repeated.delete', function (Generator $breadcrumbs, PiggyBank $piggyBank) {
|
||||
$breadcrumbs->parent('repeated.show', $piggyBank);
|
||||
$breadcrumbs->push('Delete ' . $piggyBank->name, route('repeated.delete', $piggyBank->id));
|
||||
}
|
||||
);
|
||||
|
||||
Breadcrumbs::register(
|
||||
'repeated.show', function (Generator $breadcrumbs, Piggybank $piggyBank) {
|
||||
'repeated.show', function (Generator $breadcrumbs, PiggyBank $piggyBank) {
|
||||
$breadcrumbs->parent('repeated.index');
|
||||
$breadcrumbs->push($piggyBank->name, route('repeated.show', $piggyBank->id));
|
||||
|
||||
|
@ -43,7 +43,7 @@ class Cleanup extends Command
|
||||
$this->info('Cleared compiled...');
|
||||
Artisan::call('ide-helper:generate');
|
||||
$this->info('IDE helper, done...');
|
||||
Artisan::call('ide-helper:models', ['nowrite']);
|
||||
Artisan::call('ide-helper:models');
|
||||
$this->info('IDE models, done...');
|
||||
Artisan::call('optimize');
|
||||
$this->info('Optimized...');
|
||||
|
@ -3,7 +3,7 @@
|
||||
return [
|
||||
'index_periods' => ['1D', '1W', '1M', '3M', '6M', '1Y', 'custom'],
|
||||
'budget_periods' => ['daily', 'weekly', 'monthly', 'quarterly', 'half-year', 'yearly'],
|
||||
'piggybank_periods' => [
|
||||
'piggy_bank_periods' => [
|
||||
'week' => 'Week',
|
||||
'month' => 'Month',
|
||||
'quarter' => 'Quarter',
|
||||
|
@ -312,16 +312,16 @@ class GoogleChartController extends BaseController
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Piggybank $piggyBank
|
||||
* @param PiggyBank $piggyBank
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function piggyBankHistory(\Piggybank $piggyBank)
|
||||
public function piggyBankHistory(\PiggyBank $piggyBank)
|
||||
{
|
||||
$this->_chart->addColumn('Date', 'date');
|
||||
$this->_chart->addColumn('Balance', 'number');
|
||||
|
||||
$set = \DB::table('piggy_bank_events')->where('piggybank_id', $piggyBank->id)->groupBy('date')->get(['date', DB::Raw('SUM(`amount`) AS `sum`')]);
|
||||
$set = \DB::table('piggy_bank_events')->where('piggy_bank_id', $piggyBank->id)->groupBy('date')->get(['date', DB::Raw('SUM(`amount`) AS `sum`')]);
|
||||
|
||||
foreach ($set as $entry) {
|
||||
$this->_chart->addRow(new Carbon($entry->date), floatval($entry->sum));
|
||||
|
@ -13,10 +13,10 @@ use Illuminate\Support\Collection;
|
||||
* @SuppressWarnings("CouplingBetweenObjects") // There's only so much I can remove.
|
||||
*
|
||||
*
|
||||
* Class PiggybankController
|
||||
* Class PiggyBankController
|
||||
*
|
||||
*/
|
||||
class PiggybankController extends BaseController
|
||||
class PiggyBankController extends BaseController
|
||||
{
|
||||
|
||||
/** @var Repository */
|
||||
@ -35,11 +35,11 @@ class PiggybankController extends BaseController
|
||||
/**
|
||||
* Add money to piggy bank
|
||||
*
|
||||
* @param Piggybank $piggyBank
|
||||
* @param PiggyBank $piggyBank
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function add(Piggybank $piggyBank)
|
||||
public function add(PiggyBank $piggyBank)
|
||||
{
|
||||
$leftOnAccount = $this->_repository->leftOnAccount($piggyBank->account);
|
||||
$savedSoFar = $piggyBank->currentRelevantRep()->currentamount;
|
||||
@ -49,7 +49,7 @@ class PiggybankController extends BaseController
|
||||
|
||||
\Log::debug('Now going to view for piggy bank #' . $piggyBank->id . ' (' . $piggyBank->name . ')');
|
||||
|
||||
return View::make('piggybanks.add', compact('piggyBank', 'maxAmount'));
|
||||
return View::make('piggy_banks.add', compact('piggyBank', 'maxAmount'));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -61,52 +61,52 @@ class PiggybankController extends BaseController
|
||||
/** @var \FireflyIII\Database\Account\Account $acct */
|
||||
$acct = App::make('FireflyIII\Database\Account\Account');
|
||||
|
||||
$periods = Config::get('firefly.piggybank_periods');
|
||||
$periods = Config::get('firefly.piggy_bank_periods');
|
||||
$accounts = FFForm::makeSelectList($acct->getAssetAccounts());
|
||||
$subTitle = 'Create new piggy bank';
|
||||
$subTitleIcon = 'fa-plus';
|
||||
|
||||
return View::make('piggybanks.create', compact('accounts', 'periods', 'subTitle', 'subTitleIcon'));
|
||||
return View::make('piggy_banks.create', compact('accounts', 'periods', 'subTitle', 'subTitleIcon'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Piggybank $piggyBank
|
||||
* @param PiggyBank $piggyBank
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function delete(Piggybank $piggyBank)
|
||||
public function delete(PiggyBank $piggyBank)
|
||||
{
|
||||
$subTitle = 'Delete "' . e($piggyBank->name) . '"';
|
||||
|
||||
return View::make('piggybanks.delete', compact('piggyBank', 'subTitle'));
|
||||
return View::make('piggy_banks.delete', compact('piggyBank', 'subTitle'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Piggybank $piggyBank
|
||||
* @param PiggyBank $piggyBank
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function destroy(Piggybank $piggyBank)
|
||||
public function destroy(PiggyBank $piggyBank)
|
||||
{
|
||||
|
||||
Session::flash('success', 'Piggy bank "' . e($piggyBank->name) . '" deleted.');
|
||||
$this->_repository->destroy($piggyBank);
|
||||
|
||||
return Redirect::route('piggybanks.index');
|
||||
return Redirect::route('piggy_banks.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Piggybank $piggyBank
|
||||
* @param PiggyBank $piggyBank
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function edit(Piggybank $piggyBank)
|
||||
public function edit(PiggyBank $piggyBank)
|
||||
{
|
||||
|
||||
/** @var \FireflyIII\Database\Account\Account $acct */
|
||||
$acct = App::make('FireflyIII\Database\Account\Account');
|
||||
|
||||
$periods = Config::get('firefly.piggybank_periods');
|
||||
$periods = Config::get('firefly.piggy_bank_periods');
|
||||
$accounts = FFForm::makeSelectList($acct->getAssetAccounts());
|
||||
$subTitle = 'Edit piggy bank "' . e($piggyBank->name) . '"';
|
||||
$subTitleIcon = 'fa-pencil';
|
||||
@ -129,7 +129,7 @@ class PiggybankController extends BaseController
|
||||
];
|
||||
Session::flash('preFilled', $preFilled);
|
||||
|
||||
return View::make('piggybanks.edit', compact('subTitle', 'subTitleIcon', 'piggyBank', 'accounts', 'periods', 'preFilled'));
|
||||
return View::make('piggy_banks.edit', compact('subTitle', 'subTitleIcon', 'piggyBank', 'accounts', 'periods', 'preFilled'));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -141,7 +141,7 @@ class PiggybankController extends BaseController
|
||||
$piggyBanks = $this->_repository->get();
|
||||
|
||||
$accounts = [];
|
||||
/** @var Piggybank $piggyBank */
|
||||
/** @var PiggyBank $piggyBank */
|
||||
foreach ($piggyBanks as $piggyBank) {
|
||||
$piggyBank->savedSoFar = floatval($piggyBank->currentRelevantRep()->currentamount);
|
||||
$piggyBank->percentage = intval($piggyBank->savedSoFar / $piggyBank->targetamount * 100);
|
||||
@ -167,17 +167,17 @@ class PiggybankController extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
return View::make('piggybanks.index', compact('piggyBanks', 'accounts'));
|
||||
return View::make('piggy_banks.index', compact('piggyBanks', 'accounts'));
|
||||
}
|
||||
|
||||
/**
|
||||
* POST add money to piggy bank
|
||||
*
|
||||
* @param Piggybank $piggyBank
|
||||
* @param PiggyBank $piggyBank
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function postAdd(Piggybank $piggyBank)
|
||||
public function postAdd(PiggyBank $piggyBank)
|
||||
{
|
||||
$amount = round(floatval(Input::get('amount')), 2);
|
||||
|
||||
@ -197,22 +197,22 @@ class PiggybankController extends BaseController
|
||||
/*
|
||||
* Create event!
|
||||
*/
|
||||
Event::fire('piggybank.addMoney', [$piggyBank, $amount]); // new and used.
|
||||
Event::fire('piggy_bank.addMoney', [$piggyBank, $amount]); // new and used.
|
||||
|
||||
Session::flash('success', 'Added ' . mf($amount, false) . ' to "' . e($piggyBank->name) . '".');
|
||||
} else {
|
||||
Session::flash('error', 'Could not add ' . mf($amount, false) . ' to "' . e($piggyBank->name) . '".');
|
||||
}
|
||||
|
||||
return Redirect::route('piggybanks.index');
|
||||
return Redirect::route('piggy_banks.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Piggybank $piggyBank
|
||||
* @param PiggyBank $piggyBank
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function postRemove(Piggybank $piggyBank)
|
||||
public function postRemove(PiggyBank $piggyBank)
|
||||
{
|
||||
$amount = floatval(Input::get('amount'));
|
||||
|
||||
@ -226,35 +226,35 @@ class PiggybankController extends BaseController
|
||||
/*
|
||||
* Create event!
|
||||
*/
|
||||
Event::fire('piggybank.removeMoney', [$piggyBank, $amount]); // new and used.
|
||||
Event::fire('piggy_bank.removeMoney', [$piggyBank, $amount]); // new and used.
|
||||
|
||||
Session::flash('success', 'Removed ' . mf($amount, false) . ' from "' . e($piggyBank->name) . '".');
|
||||
} else {
|
||||
Session::flash('error', 'Could not remove ' . mf($amount, false) . ' from "' . e($piggyBank->name) . '".');
|
||||
}
|
||||
|
||||
return Redirect::route('piggybanks.index');
|
||||
return Redirect::route('piggy_banks.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Piggybank $piggyBank
|
||||
* @param PiggyBank $piggyBank
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function remove(Piggybank $piggyBank)
|
||||
public function remove(PiggyBank $piggyBank)
|
||||
{
|
||||
return View::make('piggybanks.remove',compact('piggyBank'));
|
||||
return View::make('piggy_banks.remove',compact('piggyBank'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Piggybank $piggyBank
|
||||
* @param PiggyBank $piggyBank
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function show(Piggybank $piggyBank)
|
||||
public function show(PiggyBank $piggyBank)
|
||||
{
|
||||
|
||||
$events = $piggyBank->piggybankevents()->orderBy('date', 'DESC')->orderBy('id', 'DESC')->get();
|
||||
$events = $piggyBank->piggyBankEvents()->orderBy('date', 'DESC')->orderBy('id', 'DESC')->get();
|
||||
|
||||
/*
|
||||
* Number of reminders:
|
||||
@ -264,7 +264,7 @@ class PiggybankController extends BaseController
|
||||
$remindersCount = $piggyBank->countFutureReminders();
|
||||
$subTitle = e($piggyBank->name);
|
||||
|
||||
return View::make('piggybanks.show', compact('amountPerReminder', 'remindersCount', 'piggyBank', 'events', 'subTitle'));
|
||||
return View::make('piggy_banks.show', compact('amountPerReminder', 'remindersCount', 'piggyBank', 'events', 'subTitle'));
|
||||
|
||||
}
|
||||
|
||||
@ -292,27 +292,27 @@ class PiggybankController extends BaseController
|
||||
|
||||
// return to create screen:
|
||||
if ($data['post_submit_action'] == 'validate_only' || $messages['errors']->count() > 0) {
|
||||
return Redirect::route('piggybanks.create')->withInput();
|
||||
return Redirect::route('piggy_banks.create')->withInput();
|
||||
}
|
||||
|
||||
// store:
|
||||
$piggyBank = $this->_repository->store($data);
|
||||
Event::fire('piggybank.store', [$piggyBank]); // new and used.
|
||||
Event::fire('piggy_bank.store', [$piggyBank]); // new and used.
|
||||
Session::flash('success', 'Piggy bank "' . e($data['name']) . '" stored.');
|
||||
if ($data['post_submit_action'] == 'store') {
|
||||
return Redirect::route('piggybanks.index');
|
||||
return Redirect::route('piggy_banks.index');
|
||||
}
|
||||
|
||||
return Redirect::route('piggybanks.create')->withInput();
|
||||
return Redirect::route('piggy_banks.create')->withInput();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Piggybank $piggyBank
|
||||
* @param PiggyBank $piggyBank
|
||||
*
|
||||
* @return $this
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function update(Piggybank $piggyBank)
|
||||
public function update(PiggyBank $piggyBank)
|
||||
{
|
||||
|
||||
$data = Input::except('_token');
|
||||
@ -335,7 +335,7 @@ class PiggybankController extends BaseController
|
||||
|
||||
// return to update screen:
|
||||
if ($data['post_submit_action'] == 'validate_only' || $messages['errors']->count() > 0) {
|
||||
return Redirect::route('piggybanks.edit', $piggyBank->id)->withInput();
|
||||
return Redirect::route('piggy_banks.edit', $piggyBank->id)->withInput();
|
||||
}
|
||||
|
||||
// update
|
||||
@ -344,11 +344,11 @@ class PiggybankController extends BaseController
|
||||
|
||||
// go back to list
|
||||
if ($data['post_submit_action'] == 'update') {
|
||||
return Redirect::route('piggybanks.index');
|
||||
return Redirect::route('piggy_banks.index');
|
||||
}
|
||||
|
||||
// go back to update screen.
|
||||
return Redirect::route('piggybanks.edit', $piggyBank->id)->withInput(['post_submit_action' => 'return_to_edit']);
|
||||
return Redirect::route('piggy_banks.edit', $piggyBank->id)->withInput(['post_submit_action' => 'return_to_edit']);
|
||||
|
||||
}
|
||||
}
|
@ -36,7 +36,7 @@ class ReminderController extends BaseController
|
||||
$preFilled = [
|
||||
'amount' => round($amount, 2),
|
||||
'description' => 'Money for ' . $reminder->remindersable->name,
|
||||
'piggybank_id' => $reminder->remindersable_id,
|
||||
'piggy_bank_id' => $reminder->remindersable_id,
|
||||
'account_to_id' => $reminder->remindersable->account_id
|
||||
];
|
||||
Session::flash('preFilled', $preFilled);
|
||||
|
@ -30,7 +30,7 @@ class RepeatedExpenseController extends BaseController
|
||||
/** @var \FireflyIII\Database\Account\Account $acct */
|
||||
$acct = App::make('FireflyIII\Database\Account\Account');
|
||||
|
||||
$periods = Config::get('firefly.piggybank_periods');
|
||||
$periods = Config::get('firefly.piggy_bank_periods');
|
||||
|
||||
|
||||
$accounts = FFForm::makeSelectList($acct->getAssetAccounts());
|
||||
@ -53,7 +53,7 @@ class RepeatedExpenseController extends BaseController
|
||||
|
||||
$expenses = $repository->get();
|
||||
$expenses->each(
|
||||
function (Piggybank $piggyBank) use ($repository) {
|
||||
function (PiggyBank $piggyBank) use ($repository) {
|
||||
$piggyBank->currentRelevantRep();
|
||||
}
|
||||
);
|
||||
@ -62,11 +62,11 @@ class RepeatedExpenseController extends BaseController
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Piggybank $piggyBank
|
||||
* @param PiggyBank $piggyBank
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function show(Piggybank $piggyBank)
|
||||
public function show(PiggyBank $piggyBank)
|
||||
{
|
||||
$subTitle = $piggyBank->name;
|
||||
$today = Carbon::now();
|
||||
@ -74,9 +74,9 @@ class RepeatedExpenseController extends BaseController
|
||||
/** @var \FireflyIII\Database\PiggyBank\RepeatedExpense $repository */
|
||||
$repository = App::make('FireflyIII\Database\PiggyBank\RepeatedExpense');
|
||||
|
||||
$repetitions = $piggyBank->piggybankrepetitions()->get();
|
||||
$repetitions = $piggyBank->piggyBankRepetitions()->get();
|
||||
$repetitions->each(
|
||||
function (PiggybankRepetition $repetition) use ($repository) {
|
||||
function (PiggyBankRepetition $repetition) use ($repository) {
|
||||
$repetition->bars = $repository->calculateParts($repetition);
|
||||
}
|
||||
);
|
||||
|
@ -227,7 +227,7 @@ class TransactionController extends BaseController
|
||||
'date' => $journal->date->format('Y-m-d'),
|
||||
'category' => '',
|
||||
'budget_id' => 0,
|
||||
'piggybank_id' => 0
|
||||
'piggy_bank_id' => 0
|
||||
];
|
||||
|
||||
/*
|
||||
@ -289,8 +289,8 @@ class TransactionController extends BaseController
|
||||
$preFilled['account_to_id'] = $journal->transactions[0]->account->id;
|
||||
$preFilled['amount'] = floatval($journal->transactions[0]->amount);
|
||||
}
|
||||
if ($journal->piggybankevents()->count() > 0) {
|
||||
$preFilled['piggybank_id'] = $journal->piggybankevents()->first()->piggybank_id;
|
||||
if ($journal->piggyBankEvents()->count() > 0) {
|
||||
$preFilled['piggy_bank_id'] = $journal->piggyBankEvents()->first()->piggy_bank_id;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -461,7 +461,7 @@ class TransactionController extends BaseController
|
||||
* Trigger a search for the related (if selected)
|
||||
* piggy bank and store an event.
|
||||
*/
|
||||
Event::fire('transactionJournal.store', [$journal, Input::get('piggybank_id')]); // new and used.
|
||||
Event::fire('transactionJournal.store', [$journal, Input::get('piggy_bank_id')]); // new and used.
|
||||
/*
|
||||
* Also trigger on both transactions.
|
||||
*/
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Down:
|
||||
|
@ -79,7 +79,7 @@ class TestContentSeeder extends Seeder
|
||||
Component::create(['user_id' => $user->id, 'name' => 'Some Component 7', 'class' => 'Category']);
|
||||
|
||||
// piggy bank
|
||||
$piggy = Piggybank::create(
|
||||
$piggy = PiggyBank::create(
|
||||
[
|
||||
'account_id' => $savings->id,
|
||||
'name' => 'New camera',
|
||||
@ -96,10 +96,10 @@ class TestContentSeeder extends Seeder
|
||||
'order' => 0,
|
||||
]
|
||||
);
|
||||
PiggyBankEvent::create(['piggybank_id' => 1, 'date' => $startDate->format('Y-m-d'), 'amount' => 100]);
|
||||
PiggybankRepetition::create(
|
||||
PiggyBankEvent::create(['piggy_bank_id' => 1, 'date' => $startDate->format('Y-m-d'), 'amount' => 100]);
|
||||
PiggyBankRepetition::create(
|
||||
[
|
||||
'piggybank_id' => $piggy->id,
|
||||
'piggy_bank_id' => $piggy->id,
|
||||
'startdate' => Carbon::now()->format('Y-m-d'),
|
||||
'targetdate' => null,
|
||||
'currentamount' => 0
|
||||
@ -107,7 +107,7 @@ class TestContentSeeder extends Seeder
|
||||
);
|
||||
|
||||
// piggy bank
|
||||
$piggyTargeted = Piggybank::create(
|
||||
$piggyTargeted = PiggyBank::create(
|
||||
[
|
||||
'account_id' => $savings->id,
|
||||
'name' => 'New clothes',
|
||||
@ -125,10 +125,10 @@ class TestContentSeeder extends Seeder
|
||||
]
|
||||
);
|
||||
|
||||
PiggyBankEvent::create(['piggybank_id' => $piggyTargeted->id, 'date' => $startDate->format('Y-m-d'), 'amount' => 100]);
|
||||
PiggybankRepetition::create(
|
||||
PiggyBankEvent::create(['piggy_bank_id' => $piggyTargeted->id, 'date' => $startDate->format('Y-m-d'), 'amount' => 100]);
|
||||
PiggyBankRepetition::create(
|
||||
[
|
||||
'piggybank_id' => $piggyTargeted->id,
|
||||
'piggy_bank_id' => $piggyTargeted->id,
|
||||
'startdate' => Carbon::now()->format('Y-m-d'),
|
||||
'targetdate' => Carbon::now()->addMonths(4)->format('Y-m-d'),
|
||||
'currentamount' => 0
|
||||
|
@ -6,11 +6,11 @@ namespace FireflyIII\Collection;
|
||||
use Carbon\Carbon;
|
||||
|
||||
/**
|
||||
* Class PiggybankPart
|
||||
* Class PiggyBankPart
|
||||
*
|
||||
* @package FireflyIII\Collection
|
||||
*/
|
||||
class PiggybankPart
|
||||
class PiggyBankPart
|
||||
{
|
||||
/** @var float */
|
||||
public $amountPerBar;
|
||||
@ -21,7 +21,7 @@ class PiggybankPart
|
||||
/** @var \Reminder */
|
||||
public $reminder;
|
||||
|
||||
/** @var \PiggybankRepetition */
|
||||
/** @var \PiggyBankRepetition */
|
||||
public $repetition;
|
||||
|
||||
/** @var Carbon */
|
||||
@ -36,7 +36,7 @@ class PiggybankPart
|
||||
public function getReminder()
|
||||
{
|
||||
if (is_null($this->reminder)) {
|
||||
$this->reminder = $this->repetition->piggybank->reminders()->where('startdate', $this->getStartdate()->format('Y-m-d'))->where(
|
||||
$this->reminder = $this->repetition->piggyBank->reminders()->where('startdate', $this->getStartdate()->format('Y-m-d'))->where(
|
||||
'enddate', $this->getTargetdate()->format('Y-m-d')
|
||||
)->first();
|
||||
}
|
||||
@ -85,7 +85,7 @@ class PiggybankPart
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \PiggybankRepetition
|
||||
* @return \PiggyBankRepetition
|
||||
*/
|
||||
public function getRepetition()
|
||||
{
|
||||
@ -93,7 +93,7 @@ class PiggybankPart
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \PiggybankRepetition $repetition
|
||||
* @param \PiggyBankRepetition $repetition
|
||||
*/
|
||||
public function setRepetition($repetition)
|
||||
{
|
||||
|
@ -12,7 +12,7 @@ use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\MessageBag;
|
||||
|
||||
/**
|
||||
* Class Piggybank
|
||||
* Class PiggyBank
|
||||
*
|
||||
* @package FireflyIII\Database
|
||||
*/
|
||||
@ -49,7 +49,7 @@ class PiggyBank implements CUD, CommonDatabaseCalls, PiggyBankInterface
|
||||
if (!isset($data['remind_me']) || (isset($data['remind_me']) && $data['remind_me'] == 0)) {
|
||||
$data['reminder'] = null;
|
||||
}
|
||||
$piggyBank = new \Piggybank($data);
|
||||
$piggyBank = new \PiggyBank($data);
|
||||
$piggyBank->save();
|
||||
|
||||
return $piggyBank;
|
||||
@ -63,7 +63,7 @@ class PiggyBank implements CUD, CommonDatabaseCalls, PiggyBankInterface
|
||||
*/
|
||||
public function update(Eloquent $model, array $data)
|
||||
{
|
||||
/** @var \Piggybank $model */
|
||||
/** @var \PiggyBank $model */
|
||||
$model->name = $data['name'];
|
||||
$model->account_id = intval($data['account_id']);
|
||||
$model->targetamount = floatval($data['targetamount']);
|
||||
@ -129,7 +129,7 @@ class PiggyBank implements CUD, CommonDatabaseCalls, PiggyBankInterface
|
||||
if (floatval($model['targetamount']) < 0.01) {
|
||||
$errors->add('targetamount', 'Amount should be above 0.01.');
|
||||
}
|
||||
if (!in_array(ucfirst($model['reminder']), \Config::get('firefly.piggybank_periods'))) {
|
||||
if (!in_array(ucfirst($model['reminder']), \Config::get('firefly.piggy_bank_periods'))) {
|
||||
$errors->add('reminder', 'Invalid reminder period (' . $model['reminder'] . ')');
|
||||
}
|
||||
// check period.
|
||||
@ -152,7 +152,7 @@ class PiggyBank implements CUD, CommonDatabaseCalls, PiggyBankInterface
|
||||
}
|
||||
}
|
||||
|
||||
$validator = \Validator::make($model, \Piggybank::$rules);
|
||||
$validator = \Validator::make($model, \PiggyBank::$rules);
|
||||
if ($validator->invalid()) {
|
||||
$errors->merge($errors);
|
||||
}
|
||||
@ -177,11 +177,11 @@ class PiggyBank implements CUD, CommonDatabaseCalls, PiggyBankInterface
|
||||
*/
|
||||
public function find($objectId)
|
||||
{
|
||||
return \Piggybank::
|
||||
leftJoin('accounts', 'accounts.id', '=', 'piggybanks.account_id')->where('piggybanks.id', '=', $objectId)->where(
|
||||
return \PiggyBank::
|
||||
leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id')->where('piggy_banks.id', '=', $objectId)->where(
|
||||
'accounts.user_id', $this->getUser()->id
|
||||
)
|
||||
->first(['piggybanks.*']);
|
||||
->first(['piggy_banks.*']);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -205,7 +205,7 @@ class PiggyBank implements CUD, CommonDatabaseCalls, PiggyBankInterface
|
||||
*/
|
||||
public function get()
|
||||
{
|
||||
return $this->getUser()->piggybanks()->where('repeats', 0)->get();
|
||||
return $this->getUser()->piggyBanks()->where('repeats', 0)->get();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -221,17 +221,17 @@ class PiggyBank implements CUD, CommonDatabaseCalls, PiggyBankInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Piggybank $piggyBank
|
||||
* @param \PiggyBank $piggyBank
|
||||
* @param Carbon $date
|
||||
*
|
||||
* @return mixed
|
||||
* @throws FireflyException
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function findRepetitionByDate(\Piggybank $piggyBank, Carbon $date)
|
||||
public function findRepetitionByDate(\PiggyBank $piggyBank, Carbon $date)
|
||||
{
|
||||
/** @var Collection $reps */
|
||||
$reps = $piggyBank->piggybankrepetitions()->get();
|
||||
$reps = $piggyBank->piggyBankRepetitions()->get();
|
||||
if ($reps->count() == 1) {
|
||||
return $reps->first();
|
||||
}
|
||||
@ -240,7 +240,7 @@ class PiggyBank implements CUD, CommonDatabaseCalls, PiggyBankInterface
|
||||
}
|
||||
// should filter the one we need:
|
||||
$repetitions = $reps->filter(
|
||||
function (\PiggybankRepetition $rep) use ($date) {
|
||||
function (\PiggyBankRepetition $rep) use ($date) {
|
||||
if ($date >= $rep->startdate && $date <= $rep->targetdate) {
|
||||
return $rep;
|
||||
}
|
||||
@ -265,8 +265,8 @@ class PiggyBank implements CUD, CommonDatabaseCalls, PiggyBankInterface
|
||||
\Log::debug('Now in leftOnAccount() for account #'.$account->id.' ('.$account->name.')');
|
||||
$balance = \Steam::balance($account);
|
||||
\Log::debug('Steam says: ' . $balance);
|
||||
/** @var \Piggybank $p */
|
||||
foreach ($account->piggybanks()->get() as $p) {
|
||||
/** @var \PiggyBank $p */
|
||||
foreach ($account->piggyBanks()->get() as $p) {
|
||||
$balance -= $p->currentRelevantRep()->currentamount;
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ namespace FireflyIII\Database\PiggyBank;
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Collection\PiggybankPart;
|
||||
use FireflyIII\Collection\PiggyBankPart;
|
||||
use FireflyIII\Database\CommonDatabaseCalls;
|
||||
use FireflyIII\Database\CUD;
|
||||
use FireflyIII\Database\SwitchUser;
|
||||
@ -35,14 +35,14 @@ class RepeatedExpense implements CUD, CommonDatabaseCalls, PiggyBankInterface
|
||||
* other variables this method tries to divide the piggy bank into equal parts. Each is
|
||||
* accommodated by a reminder (if everything goes to plan).
|
||||
*
|
||||
* @param \PiggybankRepetition $repetition
|
||||
* @param \PiggyBankRepetition $repetition
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function calculateParts(\PiggybankRepetition $repetition)
|
||||
public function calculateParts(\PiggyBankRepetition $repetition)
|
||||
{
|
||||
/** @var \Piggybank $piggyBank */
|
||||
$piggyBank = $repetition->piggybank()->first();
|
||||
/** @var \PiggyBank $piggyBank */
|
||||
$piggyBank = $repetition->piggyBank()->first();
|
||||
$bars = new Collection;
|
||||
$currentStart = clone $repetition->startdate;
|
||||
|
||||
@ -66,7 +66,7 @@ class RepeatedExpense implements CUD, CommonDatabaseCalls, PiggyBankInterface
|
||||
}
|
||||
$amountPerBar = floatval($piggyBank->targetamount) / $bars->count();
|
||||
$cumulative = $amountPerBar;
|
||||
/** @var PiggybankPart $bar */
|
||||
/** @var PiggyBankPart $bar */
|
||||
foreach ($bars as $index => $bar) {
|
||||
$bar->setAmountPerBar($amountPerBar);
|
||||
$bar->setCumulativeAmount($cumulative);
|
||||
@ -82,11 +82,11 @@ class RepeatedExpense implements CUD, CommonDatabaseCalls, PiggyBankInterface
|
||||
/**
|
||||
* @param array $data
|
||||
*
|
||||
* @return PiggybankPart
|
||||
* @return PiggyBankPart
|
||||
*/
|
||||
public function createPiggyBankPart(array $data)
|
||||
{
|
||||
$part = new PiggybankPart;
|
||||
$part = new PiggyBankPart;
|
||||
$part->setRepetition($data['repetition']);
|
||||
$part->setAmountPerBar($data['amountPerBar']);
|
||||
$part->setCurrentamount($data['currentAmount']);
|
||||
@ -128,7 +128,7 @@ class RepeatedExpense implements CUD, CommonDatabaseCalls, PiggyBankInterface
|
||||
$data['reminder'] = null;
|
||||
}
|
||||
|
||||
$repeated = new \Piggybank($data);
|
||||
$repeated = new \PiggyBank($data);
|
||||
$repeated->save();
|
||||
|
||||
return $repeated;
|
||||
@ -200,11 +200,11 @@ class RepeatedExpense implements CUD, CommonDatabaseCalls, PiggyBankInterface
|
||||
if (floatval($model['targetamount']) < 0.01) {
|
||||
$errors->add('targetamount', 'Amount should be above 0.01.');
|
||||
}
|
||||
if (!in_array(ucfirst($model['reminder']), \Config::get('firefly.piggybank_periods'))) {
|
||||
if (!in_array(ucfirst($model['reminder']), \Config::get('firefly.piggy_bank_periods'))) {
|
||||
$errors->add('reminder', 'Invalid reminder period (' . $model['reminder'] . ')');
|
||||
}
|
||||
|
||||
if (!in_array(ucfirst($model['rep_length']), \Config::get('firefly.piggybank_periods'))) {
|
||||
if (!in_array(ucfirst($model['rep_length']), \Config::get('firefly.piggy_bank_periods'))) {
|
||||
$errors->add('rep_length', 'Invalid repeat period (' . $model['rep_length'] . ')');
|
||||
}
|
||||
|
||||
@ -228,7 +228,7 @@ class RepeatedExpense implements CUD, CommonDatabaseCalls, PiggyBankInterface
|
||||
}
|
||||
}
|
||||
|
||||
$validator = \Validator::make($model, \Piggybank::$rules);
|
||||
$validator = \Validator::make($model, \PiggyBank::$rules);
|
||||
if ($validator->invalid()) {
|
||||
$errors->merge($errors);
|
||||
}
|
||||
@ -279,7 +279,7 @@ class RepeatedExpense implements CUD, CommonDatabaseCalls, PiggyBankInterface
|
||||
*/
|
||||
public function get()
|
||||
{
|
||||
return $this->getUser()->piggybanks()->where('repeats', 1)->get();
|
||||
return $this->getUser()->piggyBanks()->where('repeats', 1)->get();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -44,8 +44,8 @@ class Transaction implements CUD, CommonDatabaseCalls
|
||||
$transaction->account()->associate($data['account']);
|
||||
$transaction->transactionJournal()->associate($data['transaction_journal']);
|
||||
$transaction->amount = floatval($data['amount']);
|
||||
if (isset($data['piggybank'])) {
|
||||
$transaction->piggybank()->associate($data['piggybank']);
|
||||
if (isset($data['piggyBank'])) {
|
||||
$transaction->piggyBank()->associate($data['piggyBank']);
|
||||
}
|
||||
if (isset($data['description'])) {
|
||||
$transaction->description = $data['description'];
|
||||
|
@ -20,10 +20,10 @@ class Event
|
||||
public function deleteAccount(\Account $account)
|
||||
{
|
||||
// get piggy banks
|
||||
$piggies = $account->piggybanks()->get();
|
||||
$piggies = $account->piggyBanks()->get();
|
||||
|
||||
// get reminders for each
|
||||
/** @var \Piggybank $piggyBank */
|
||||
/** @var \PiggyBank $piggyBank */
|
||||
foreach ($piggies as $piggyBank) {
|
||||
$reminders = $piggyBank->reminders()->get();
|
||||
/** @var \Reminder $reminder */
|
||||
|
@ -7,22 +7,22 @@ use Carbon\Carbon;
|
||||
use Illuminate\Events\Dispatcher;
|
||||
|
||||
/**
|
||||
* Class Piggybank
|
||||
* Class PiggyBank
|
||||
*
|
||||
* @package FireflyIII\Event
|
||||
*/
|
||||
class Piggybank
|
||||
class PiggyBank
|
||||
{
|
||||
|
||||
/**
|
||||
* @param \Piggybank $piggyBank
|
||||
* @param \PiggyBank $piggyBank
|
||||
* @param float $amount
|
||||
*/
|
||||
public function addMoney(\Piggybank $piggyBank, $amount = 0.0)
|
||||
public function addMoney(\PiggyBank $piggyBank, $amount = 0.0)
|
||||
{
|
||||
if ($amount > 0) {
|
||||
$event = new \PiggyBankEvent;
|
||||
$event->piggybank()->associate($piggyBank);
|
||||
$event->piggyBank()->associate($piggyBank);
|
||||
$event->amount = floatval($amount);
|
||||
$event->date = new Carbon;
|
||||
if (!$event->isValid()) {
|
||||
@ -41,15 +41,15 @@ class Piggybank
|
||||
*/
|
||||
public function destroyTransfer(\TransactionJournal $journal)
|
||||
{
|
||||
if ($journal->piggybankevents()->count() > 0) {
|
||||
if ($journal->piggyBankEvents()->count() > 0) {
|
||||
|
||||
/** @var \FireflyIII\Database\PiggyBank\PiggyBank $repository */
|
||||
$repository = \App::make('FireflyIII\Database\PiggyBank\PiggyBank');
|
||||
|
||||
/** @var \Piggybank $piggyBank */
|
||||
$piggyBank = $journal->piggybankevents()->first()->piggybank()->first();
|
||||
/** @var \PiggyBank $piggyBank */
|
||||
$piggyBank = $journal->piggyBankEvents()->first()->piggyBank()->first();
|
||||
|
||||
/** @var \PiggybankRepetition $repetition */
|
||||
/** @var \PiggyBankRepetition $repetition */
|
||||
$repetition = $repository->findRepetitionByDate($piggyBank, $journal->date);
|
||||
|
||||
$relevantTransaction = null;
|
||||
@ -68,7 +68,7 @@ class Piggybank
|
||||
|
||||
|
||||
$event = new \PiggyBankEvent;
|
||||
$event->piggybank()->associate($piggyBank);
|
||||
$event->piggyBank()->associate($piggyBank);
|
||||
$event->amount = floatval($relevantTransaction->amount * -1);
|
||||
$event->date = new Carbon;
|
||||
$event->save();
|
||||
@ -76,15 +76,15 @@ class Piggybank
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Piggybank $piggyBank
|
||||
* @param \PiggyBank $piggyBank
|
||||
* @param float $amount
|
||||
*/
|
||||
public function removeMoney(\Piggybank $piggyBank, $amount = 0.0)
|
||||
public function removeMoney(\PiggyBank $piggyBank, $amount = 0.0)
|
||||
{
|
||||
$amount = $amount * -1;
|
||||
if ($amount < 0) {
|
||||
$event = new \PiggyBankEvent;
|
||||
$event->piggybank()->associate($piggyBank);
|
||||
$event->piggyBank()->associate($piggyBank);
|
||||
$event->amount = floatval($amount);
|
||||
$event->date = new Carbon;
|
||||
$event->save();
|
||||
@ -92,13 +92,13 @@ class Piggybank
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Piggybank $piggyBank
|
||||
* @param \PiggyBank $piggyBank
|
||||
*/
|
||||
public function storePiggybank(\Piggybank $piggyBank)
|
||||
public function storePiggyBank(\PiggyBank $piggyBank)
|
||||
{
|
||||
if (intval($piggyBank->repeats) == 0) {
|
||||
$repetition = new \PiggybankRepetition;
|
||||
$repetition->piggybank()->associate($piggyBank);
|
||||
$repetition = new \PiggyBankRepetition;
|
||||
$repetition->piggyBank()->associate($piggyBank);
|
||||
$repetition->startdate = $piggyBank->startdate;
|
||||
$repetition->targetdate = $piggyBank->targetdate;
|
||||
$repetition->currentamount = 0;
|
||||
@ -122,13 +122,13 @@ class Piggybank
|
||||
/** @var \FireflyIII\Database\PiggyBank\PiggyBank $repository */
|
||||
$repository = \App::make('FireflyIII\Database\PiggyBank\PiggyBank');
|
||||
|
||||
/** @var \Piggybank $piggyBank */
|
||||
/** @var \PiggyBank $piggyBank */
|
||||
$piggyBank = $repository->find($piggyBankId);
|
||||
|
||||
if ($journal->transactions()->where('account_id', $piggyBank->account_id)->count() == 0) {
|
||||
return;
|
||||
}
|
||||
/** @var \PiggybankRepetition $repetition */
|
||||
/** @var \PiggyBankRepetition $repetition */
|
||||
$repetition = $repository->findRepetitionByDate($piggyBank, $journal->date);
|
||||
$amount = floatval($piggyBank->targetamount);
|
||||
$leftToSave = $amount - floatval($repetition->currentamount);
|
||||
@ -146,7 +146,7 @@ class Piggybank
|
||||
$repetition->currentamount += floatval($transaction->amount);
|
||||
$repetition->save();
|
||||
$event = new \PiggyBankEvent;
|
||||
$event->piggybank()->associate($piggyBank);
|
||||
$event->piggyBank()->associate($piggyBank);
|
||||
$event->transactionjournal()->associate($journal);
|
||||
$event->amount = floatval($transaction->amount);
|
||||
$event->date = new Carbon;
|
||||
@ -160,10 +160,10 @@ class Piggybank
|
||||
public function subscribe(Dispatcher $events)
|
||||
{
|
||||
// triggers on piggy bank events:
|
||||
$events->listen('piggybank.addMoney', 'FireflyIII\Event\Piggybank@addMoney');
|
||||
$events->listen('piggybank.removeMoney', 'FireflyIII\Event\Piggybank@removeMoney');
|
||||
$events->listen('piggybank.store', 'FireflyIII\Event\Piggybank@storePiggybank');
|
||||
$events->listen('piggybank.update', 'FireflyIII\Event\Piggybank@updatePiggybank');
|
||||
$events->listen('piggy_bank.addMoney', 'FireflyIII\Event\PiggyBank@addMoney');
|
||||
$events->listen('piggy_bank.removeMoney', 'FireflyIII\Event\PiggyBank@removeMoney');
|
||||
$events->listen('piggy_bank.store', 'FireflyIII\Event\PiggyBank@storePiggyBank');
|
||||
$events->listen('piggy_bank.update', 'FireflyIII\Event\PiggyBank@updatePiggyBank');
|
||||
|
||||
\App::before(
|
||||
function () {
|
||||
@ -171,13 +171,10 @@ class Piggybank
|
||||
}
|
||||
);
|
||||
|
||||
//$events->listen('piggybank.boo', 'FireflyIII\Event\Piggybank@updatePiggybank');
|
||||
|
||||
|
||||
// triggers when others are updated.
|
||||
$events->listen('transactionJournal.store', 'FireflyIII\Event\Piggybank@storeTransfer');
|
||||
$events->listen('transactionJournal.update', 'FireflyIII\Event\Piggybank@updateTransfer');
|
||||
$events->listen('transactionJournal.destroy', 'FireflyIII\Event\Piggybank@destroyTransfer');
|
||||
$events->listen('transactionJournal.store', 'FireflyIII\Event\PiggyBank@storeTransfer');
|
||||
$events->listen('transactionJournal.update', 'FireflyIII\Event\PiggyBank@updateTransfer');
|
||||
$events->listen('transactionJournal.destroy', 'FireflyIII\Event\PiggyBank@destroyTransfer');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -194,15 +191,15 @@ class Piggybank
|
||||
$list = $repository->get();
|
||||
$today = Carbon::now();
|
||||
|
||||
/** @var \Piggybank $entry */
|
||||
/** @var \PiggyBank $entry */
|
||||
foreach ($list as $entry) {
|
||||
$start = $entry->startdate;
|
||||
$target = $entry->targetdate;
|
||||
// find a repetition on this date:
|
||||
$count = $entry->piggybankrepetitions()->starts($start)->targets($target)->count();
|
||||
$count = $entry->piggyBankrepetitions()->starts($start)->targets($target)->count();
|
||||
if ($count == 0) {
|
||||
$repetition = new \PiggybankRepetition;
|
||||
$repetition->piggybank()->associate($entry);
|
||||
$repetition = new \PiggyBankRepetition;
|
||||
$repetition->piggyBank()->associate($entry);
|
||||
$repetition->startdate = $start;
|
||||
$repetition->targetdate = $target;
|
||||
$repetition->currentamount = 0;
|
||||
@ -216,10 +213,10 @@ class Piggybank
|
||||
$currentStart = \DateKit::subtractPeriod($currentTarget, $entry->rep_length, 0);
|
||||
$currentTarget = \DateKit::addPeriod($currentTarget, $entry->rep_length, 0);
|
||||
// create if not exists:
|
||||
$count = $entry->piggybankrepetitions()->starts($currentStart)->targets($currentTarget)->count();
|
||||
$count = $entry->piggyBankRepetitions()->starts($currentStart)->targets($currentTarget)->count();
|
||||
if ($count == 0) {
|
||||
$repetition = new \PiggybankRepetition;
|
||||
$repetition->piggybank()->associate($entry);
|
||||
$repetition = new \PiggyBankRepetition;
|
||||
$repetition->piggyBank()->associate($entry);
|
||||
$repetition->startdate = $currentStart;
|
||||
$repetition->targetdate = $currentTarget;
|
||||
$repetition->currentamount = 0;
|
||||
@ -231,9 +228,9 @@ class Piggybank
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Piggybank $piggyBank
|
||||
* @param \PiggyBank $piggyBank
|
||||
*/
|
||||
public function updatePiggybank(\Piggybank $piggyBank)
|
||||
public function updatePiggyBank(\PiggyBank $piggyBank)
|
||||
{
|
||||
// get the repetition:
|
||||
$repetition = $piggyBank->currentRelevantRep();
|
||||
@ -251,18 +248,18 @@ class Piggybank
|
||||
public function updateTransfer(\TransactionJournal $journal)
|
||||
{
|
||||
|
||||
if ($journal->piggybankevents()->count() > 0) {
|
||||
if ($journal->piggyBankEvents()->count() > 0) {
|
||||
|
||||
$event = $journal->piggybankevents()->orderBy('date', 'DESC')->orderBy('id', 'DESC')->first();
|
||||
$eventSum = floatval($journal->piggybankevents()->orderBy('date', 'DESC')->orderBy('id', 'DESC')->sum('amount'));
|
||||
$event = $journal->piggyBankEvents()->orderBy('date', 'DESC')->orderBy('id', 'DESC')->first();
|
||||
$eventSum = floatval($journal->piggyBankEvents()->orderBy('date', 'DESC')->orderBy('id', 'DESC')->sum('amount'));
|
||||
|
||||
/** @var \FireflyIII\Database\PiggyBank\PiggyBank $repository */
|
||||
$repository = \App::make('FireflyIII\Database\PiggyBank\PiggyBank');
|
||||
|
||||
/** @var \Piggybank $piggyBank */
|
||||
$piggyBank = $journal->piggybankevents()->first()->piggybank()->first();
|
||||
/** @var \PiggyBank $piggyBank */
|
||||
$piggyBank = $journal->piggyBankEvents()->first()->piggyBank()->first();
|
||||
|
||||
/** @var \PiggybankRepetition $repetition */
|
||||
/** @var \PiggyBankRepetition $repetition */
|
||||
$repetition = $repository->findRepetitionByDate($piggyBank, $journal->date);
|
||||
|
||||
$relevantTransaction = null;
|
||||
@ -285,7 +282,7 @@ class Piggybank
|
||||
|
||||
|
||||
$event = new \PiggyBankEvent;
|
||||
$event->piggybank()->associate($piggyBank);
|
||||
$event->piggyBank()->associate($piggyBank);
|
||||
$event->transactionJournal()->associate($journal);
|
||||
$event->amount = $diff;
|
||||
$event->date = new Carbon;
|
||||
|
@ -65,16 +65,16 @@ class Reminders
|
||||
public function updateReminders()
|
||||
{
|
||||
/** @var Collection $set */
|
||||
$set = \Piggybank::leftJoin('accounts', 'accounts.id', '=', 'piggybanks.account_id')
|
||||
$set = \PiggyBank::leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id')
|
||||
->where('accounts.user_id', \Auth::user()->id)
|
||||
->whereNotNull('reminder')->get(['piggybanks.*']);
|
||||
->whereNotNull('reminder')->get(['piggy_banks.*']);
|
||||
|
||||
|
||||
$today = Carbon::now();
|
||||
|
||||
/** @var \Piggybank $piggyBank */
|
||||
/** @var \PiggyBank $piggyBank */
|
||||
foreach ($set as $piggyBank) {
|
||||
/** @var \PiggybankRepetition $repetition */
|
||||
/** @var \PiggyBankRepetition $repetition */
|
||||
$repetition = $piggyBank->currentRelevantRep();
|
||||
$start = \DateKit::startOfPeriod($today, $piggyBank->reminder);
|
||||
if ($repetition->targetdate && $repetition->targetdate <= $today) {
|
||||
|
@ -46,12 +46,12 @@ class Steam
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Piggybank $piggyBank
|
||||
* @param \PiggybankRepetition $repetition
|
||||
* @param \PiggyBank $piggyBank
|
||||
* @param \PiggyBankRepetition $repetition
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function percentage(\Piggybank $piggyBank, \PiggybankRepetition $repetition)
|
||||
public function percentage(\PiggyBank $piggyBank, \PiggyBankRepetition $repetition)
|
||||
{
|
||||
$pct = $repetition->currentamount / $piggyBank->targetamount * 100;
|
||||
if ($pct > 100) {
|
||||
|
@ -57,9 +57,9 @@ class Account extends Eloquent
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function piggybanks()
|
||||
public function piggyBanks()
|
||||
{
|
||||
return $this->hasMany('Piggybank');
|
||||
return $this->hasMany('PiggyBank');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4,9 +4,9 @@ use Illuminate\Database\Eloquent\Model as Eloquent;
|
||||
use Watson\Validating\ValidatingTrait;
|
||||
|
||||
/**
|
||||
* Class Piggybank
|
||||
* Class PiggyBank
|
||||
*/
|
||||
class Piggybank extends Eloquent
|
||||
class PiggyBank extends Eloquent
|
||||
{
|
||||
use ValidatingTrait;
|
||||
public static $rules
|
||||
@ -62,12 +62,12 @@ class Piggybank extends Eloquent
|
||||
* @param Carbon $start
|
||||
* @param Carbon $target
|
||||
*
|
||||
* @return PiggybankRepetition
|
||||
* @return PiggyBankRepetition
|
||||
*/
|
||||
public function createRepetition(Carbon $start = null, Carbon $target = null)
|
||||
{
|
||||
$rep = new \PiggybankRepetition;
|
||||
$rep->piggybank()->associate($this);
|
||||
$rep = new \PiggyBankRepetition;
|
||||
$rep->piggyBank()->associate($this);
|
||||
$rep->startdate = $start;
|
||||
$rep->targetdate = $target;
|
||||
$rep->currentamount = 0;
|
||||
@ -81,7 +81,7 @@ class Piggybank extends Eloquent
|
||||
*
|
||||
* Grabs the PiggyBankRepetition that's currently relevant / active
|
||||
*
|
||||
* @returns \PiggybankRepetition
|
||||
* @returns \PiggyBankRepetition
|
||||
*/
|
||||
public function currentRelevantRep()
|
||||
{
|
||||
@ -89,13 +89,13 @@ class Piggybank extends Eloquent
|
||||
return $this->currentRep;
|
||||
}
|
||||
if ($this->repeats == 0) {
|
||||
$rep = $this->piggybankrepetitions()->first(['piggybank_repetitions.*']);
|
||||
$rep = $this->piggyBankRepetitions()->first(['piggy_bank_repetitions.*']);
|
||||
$this->currentRep = $rep;
|
||||
\Log::debug('currentRelevantRep() reports $rep is null: ' . boolstr(is_null($rep)));
|
||||
|
||||
return $rep;
|
||||
} else {
|
||||
$query = $this->piggybankrepetitions()->where(
|
||||
$query = $this->piggyBankRepetitions()->where(
|
||||
function ($q) {
|
||||
|
||||
$q->where(
|
||||
@ -126,7 +126,7 @@ class Piggybank extends Eloquent
|
||||
}
|
||||
)
|
||||
->orderBy('startdate', 'ASC');
|
||||
$result = $query->first(['piggybank_repetitions.*']);
|
||||
$result = $query->first(['piggy_bank_repetitions.*']);
|
||||
$this->currentRep = $result;
|
||||
\Log::debug('Found relevant rep in currentRelevantRep(): ' . $result->id);
|
||||
|
||||
@ -139,9 +139,9 @@ class Piggybank extends Eloquent
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function piggybankrepetitions()
|
||||
public function piggyBankRepetitions()
|
||||
{
|
||||
return $this->hasMany('PiggybankRepetition');
|
||||
return $this->hasMany('PiggyBankRepetition');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -155,9 +155,9 @@ class Piggybank extends Eloquent
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function piggybankevents()
|
||||
public function piggyBankEvents()
|
||||
{
|
||||
return $this->hasMany('PiggybankEvent');
|
||||
return $this->hasMany('PiggyBankEvent');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -175,11 +175,11 @@ class Piggybank extends Eloquent
|
||||
*
|
||||
* @param Carbon $date
|
||||
*
|
||||
* @returns \PiggybankRepetition
|
||||
* @returns \PiggyBankRepetition
|
||||
*/
|
||||
public function repetitionForDate(Carbon $date)
|
||||
{
|
||||
$query = $this->piggybankrepetitions()->where(
|
||||
$query = $this->piggyBankRepetitions()->where(
|
||||
function ($q) use ($date) {
|
||||
|
||||
$q->where(
|
||||
|
@ -9,7 +9,7 @@ class PiggyBankEvent extends Eloquent
|
||||
|
||||
public static $rules
|
||||
= [
|
||||
'piggybank_id' => 'required|exists:piggybanks,id',
|
||||
'piggy_bank_id' => 'required|exists:piggy_banks,id',
|
||||
'date' => 'required|date',
|
||||
'amount' => 'required|numeric'
|
||||
];
|
||||
@ -26,9 +26,9 @@ class PiggyBankEvent extends Eloquent
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function piggybank()
|
||||
public function piggyBank()
|
||||
{
|
||||
return $this->belongsTo('Piggybank');
|
||||
return $this->belongsTo('PiggyBank');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4,14 +4,14 @@ use Illuminate\Database\Eloquent\Builder;
|
||||
use Watson\Validating\ValidatingTrait;
|
||||
use \Illuminate\Database\Eloquent\Model as Eloquent;
|
||||
/**
|
||||
* Class PiggybankRepetition
|
||||
* Class PiggyBankRepetition
|
||||
*/
|
||||
class PiggybankRepetition extends Eloquent
|
||||
class PiggyBankRepetition extends Eloquent
|
||||
{
|
||||
use ValidatingTrait;
|
||||
public static $rules
|
||||
= [
|
||||
'piggybank_id' => 'required|exists:piggybanks,id',
|
||||
'piggy_bank_id' => 'required|exists:piggy_banks,id',
|
||||
'targetdate' => 'date',
|
||||
'startdate' => 'date',
|
||||
'currentamount' => 'required|numeric'];
|
||||
@ -31,7 +31,7 @@ class PiggybankRepetition extends Eloquent
|
||||
*/
|
||||
public function pct()
|
||||
{
|
||||
$total = $this->piggybank->targetamount;
|
||||
$total = $this->piggyBank->targetamount;
|
||||
$saved = $this->currentamount;
|
||||
if ($total == 0) {
|
||||
return 0;
|
||||
@ -44,9 +44,9 @@ class PiggybankRepetition extends Eloquent
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function piggybank()
|
||||
public function piggyBank()
|
||||
{
|
||||
return $this->belongsTo('Piggybank');
|
||||
return $this->belongsTo('PiggyBank');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -13,7 +13,6 @@ class Transaction extends Eloquent
|
||||
use SoftDeletingTrait, ValidatingTrait;
|
||||
public static $rules
|
||||
= ['account_id' => 'numeric|required|exists:accounts,id',
|
||||
'piggybank_id' => 'numeric|exists:piggybanks,id',
|
||||
'transaction_journal_id' => 'numeric|required|exists:transaction_journals,id',
|
||||
'description' => 'between:1,255',
|
||||
'amount' => 'required|between:-65536,65536|not_in:0,0.00',];
|
||||
@ -31,7 +30,7 @@ class Transaction extends Eloquent
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function piggybank()
|
||||
public function piggyBank()
|
||||
{
|
||||
return $this->belongsTo('Piggybank');
|
||||
}
|
||||
|
@ -77,9 +77,9 @@ class TransactionJournal extends Eloquent
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function piggybankevents()
|
||||
public function piggyBankEvents()
|
||||
{
|
||||
return $this->hasMany('PiggybankEvent');
|
||||
return $this->hasMany('PiggyBankEvent');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -53,7 +53,7 @@ class User extends Eloquent implements UserInterface, RemindableInterface
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
|
||||
*/
|
||||
public function piggybanks()
|
||||
public function piggyBanks()
|
||||
{
|
||||
return $this->hasManyThrough('Piggybank', 'Account');
|
||||
}
|
||||
|
@ -116,13 +116,13 @@ Route::bind(
|
||||
);
|
||||
|
||||
Route::bind(
|
||||
'piggybank', function ($value, $route) {
|
||||
'piggy_bank', function ($value, $route) {
|
||||
if (Auth::check()) {
|
||||
return Piggybank::
|
||||
where('piggybanks.id', $value)
|
||||
->leftJoin('accounts', 'accounts.id', '=', 'piggybanks.account_id')
|
||||
return PiggyBank::
|
||||
where('piggy_banks.id', $value)
|
||||
->leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id')
|
||||
->where('accounts.user_id', Auth::user()->id)
|
||||
->where('repeats', 0)->first(['piggybanks.*']);
|
||||
->where('repeats', 0)->first(['piggy_banks.*']);
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -132,11 +132,11 @@ Route::bind(
|
||||
Route::bind(
|
||||
'repeated', function ($value, $route) {
|
||||
if (Auth::check()) {
|
||||
return Piggybank::
|
||||
where('piggybanks.id', $value)
|
||||
->leftJoin('accounts', 'accounts.id', '=', 'piggybanks.account_id')
|
||||
return PiggyBank::
|
||||
where('piggy_banks.id', $value)
|
||||
->leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id')
|
||||
->where('accounts.user_id', Auth::user()->id)
|
||||
->where('repeats', 1)->first(['piggybanks.*']);
|
||||
->where('repeats', 1)->first(['piggy_banks.*']);
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -195,7 +195,7 @@ Route::group(
|
||||
Route::get('/chart/reports/income-expenses-sum/{year}', ['uses' => 'GoogleChartController@yearInExpSum']);
|
||||
Route::get('/chart/recurring/{recurring}', ['uses' => 'GoogleChartController@recurringOverview']);
|
||||
Route::get('/chart/budget/{budget}/{limitrepetition}', ['uses' => 'GoogleChartController@budgetLimitSpending']);
|
||||
Route::get('/chart/piggyhistory/{piggybank}', ['uses' => 'GoogleChartController@piggyBankHistory']);
|
||||
Route::get('/chart/piggy_history/{piggy_bank}', ['uses' => 'GoogleChartController@piggyBankHistory']);
|
||||
|
||||
// google chart for components (categories + budgets combined)
|
||||
Route::get('/chart/budget/{budget}/spending/{year}', ['uses' => 'GoogleChartController@budgetsAndSpending']);
|
||||
@ -215,14 +215,14 @@ Route::group(
|
||||
|
||||
|
||||
// piggy bank controller
|
||||
Route::get('/piggybanks', ['uses' => 'PiggybankController@index', 'as' => 'piggybanks.index']);
|
||||
Route::get('/piggybanks/add/{piggybank}', ['uses' => 'PiggybankController@add']); # add money
|
||||
Route::get('/piggybanks/remove/{piggybank}', ['uses' => 'PiggybankController@remove']); #remove money
|
||||
Route::get('/piggy_banks', ['uses' => 'PiggybankController@index', 'as' => 'piggy_banks.index']);
|
||||
Route::get('/piggy_banks/add/{piggy_bank}', ['uses' => 'PiggybankController@add']); # add money
|
||||
Route::get('/piggy_banks/remove/{piggy_bank}', ['uses' => 'PiggybankController@remove']); #remove money
|
||||
|
||||
Route::get('/piggybanks/create', ['uses' => 'PiggybankController@create', 'as' => 'piggybanks.create']);
|
||||
Route::get('/piggybanks/edit/{piggybank}', ['uses' => 'PiggybankController@edit', 'as' => 'piggybanks.edit']);
|
||||
Route::get('/piggybanks/delete/{piggybank}', ['uses' => 'PiggybankController@delete', 'as' => 'piggybanks.delete']);
|
||||
Route::get('/piggybanks/show/{piggybank}', ['uses' => 'PiggybankController@show', 'as' => 'piggybanks.show']);
|
||||
Route::get('/piggy_banks/create', ['uses' => 'PiggybankController@create', 'as' => 'piggy_banks.create']);
|
||||
Route::get('/piggy_banks/edit/{piggy_bank}', ['uses' => 'PiggybankController@edit', 'as' => 'piggy_banks.edit']);
|
||||
Route::get('/piggy_banks/delete/{piggy_bank}', ['uses' => 'PiggybankController@delete', 'as' => 'piggy_banks.delete']);
|
||||
Route::get('/piggy_banks/show/{piggy_bank}', ['uses' => 'PiggybankController@show', 'as' => 'piggy_banks.show']);
|
||||
|
||||
// preferences controller
|
||||
Route::get('/preferences', ['uses' => 'PreferencesController@index', 'as' => 'preferences']);
|
||||
@ -308,11 +308,11 @@ Route::group(
|
||||
Route::post('/currency/destroy/{currency}', ['uses' => 'CurrencyController@destroy', 'as' => 'currency.destroy']);
|
||||
|
||||
// piggy bank controller
|
||||
Route::post('/piggybanks/store', ['uses' => 'PiggybankController@store', 'as' => 'piggybanks.store']);
|
||||
Route::post('/piggybanks/update/{piggybank}', ['uses' => 'PiggybankController@update', 'as' => 'piggybanks.update']);
|
||||
Route::post('/piggybanks/destroy/{piggybank}', ['uses' => 'PiggybankController@destroy', 'as' => 'piggybanks.destroy']);
|
||||
Route::post('/piggybanks/add/{piggybank}', ['uses' => 'PiggybankController@postAdd', 'as' => 'piggybanks.add']); # add money
|
||||
Route::post('/piggybanks/remove/{piggybank}', ['uses' => 'PiggybankController@postRemove', 'as' => 'piggybanks.remove']); # remove money.
|
||||
Route::post('/piggy_banks/store', ['uses' => 'PiggybankController@store', 'as' => 'piggy_banks.store']);
|
||||
Route::post('/piggy_banks/update/{piggy_bank}', ['uses' => 'PiggybankController@update', 'as' => 'piggy_banks.update']);
|
||||
Route::post('/piggy_banks/destroy/{piggy_bank}', ['uses' => 'PiggybankController@destroy', 'as' => 'piggy_banks.destroy']);
|
||||
Route::post('/piggy_banks/add/{piggy_bank}', ['uses' => 'PiggybankController@postAdd', 'as' => 'piggy_banks.add']); # add money
|
||||
Route::post('/piggy_banks/remove/{piggy_bank}', ['uses' => 'PiggybankController@postRemove', 'as' => 'piggy_banks.remove']); # remove money.
|
||||
|
||||
// repeated expense controller
|
||||
Route::post('/repeatedexpense/store', ['uses' => 'RepeatedExpenseController@store', 'as' => 'repeated.store']);
|
||||
|
@ -1,12 +1,12 @@
|
||||
<?php
|
||||
use FireflyIII\Collection\PiggybankPart;
|
||||
use FireflyIII\Collection\PiggyBankPart;
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2014-12-20 at 06:56:52.
|
||||
*/
|
||||
class PiggybankPartTest extends \PHPUnit_Framework_TestCase
|
||||
class PiggyBankPartTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @var PiggybankPart
|
||||
* @var PiggyBankPart
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
@ -16,7 +16,7 @@ class PiggybankPartTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
$this->object = new PiggybankPart;
|
||||
$this->object = new PiggyBankPart;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -28,7 +28,7 @@ class PiggybankPartTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Collection\PiggybankPart::getReminder
|
||||
* @covers FireflyIII\Collection\PiggyBankPart::getReminder
|
||||
* @todo Implement testGetReminder().
|
||||
*/
|
||||
public function testGetReminder()
|
||||
@ -41,7 +41,7 @@ class PiggybankPartTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Collection\PiggybankPart::setReminder
|
||||
* @covers FireflyIII\Collection\PiggyBankPart::setReminder
|
||||
* @todo Implement testSetReminder().
|
||||
*/
|
||||
public function testSetReminder()
|
||||
@ -53,7 +53,7 @@ class PiggybankPartTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Collection\PiggybankPart::getStartdate
|
||||
* @covers FireflyIII\Collection\PiggyBankPart::getStartdate
|
||||
* @todo Implement testGetStartdate().
|
||||
*/
|
||||
public function testGetStartdate()
|
||||
@ -65,7 +65,7 @@ class PiggybankPartTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Collection\PiggybankPart::setStartdate
|
||||
* @covers FireflyIII\Collection\PiggyBankPart::setStartdate
|
||||
* @todo Implement testSetStartdate().
|
||||
*/
|
||||
public function testSetStartdate()
|
||||
@ -77,7 +77,7 @@ class PiggybankPartTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Collection\PiggybankPart::getTargetdate
|
||||
* @covers FireflyIII\Collection\PiggyBankPart::getTargetdate
|
||||
* @todo Implement testGetTargetdate().
|
||||
*/
|
||||
public function testGetTargetdate()
|
||||
@ -89,7 +89,7 @@ class PiggybankPartTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Collection\PiggybankPart::setTargetdate
|
||||
* @covers FireflyIII\Collection\PiggyBankPart::setTargetdate
|
||||
* @todo Implement testSetTargetdate().
|
||||
*/
|
||||
public function testSetTargetdate()
|
||||
@ -101,7 +101,7 @@ class PiggybankPartTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Collection\PiggybankPart::getRepetition
|
||||
* @covers FireflyIII\Collection\PiggyBankPart::getRepetition
|
||||
* @todo Implement testGetRepetition().
|
||||
*/
|
||||
public function testGetRepetition()
|
||||
@ -113,7 +113,7 @@ class PiggybankPartTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Collection\PiggybankPart::setRepetition
|
||||
* @covers FireflyIII\Collection\PiggyBankPart::setRepetition
|
||||
* @todo Implement testSetRepetition().
|
||||
*/
|
||||
public function testSetRepetition()
|
||||
@ -125,7 +125,7 @@ class PiggybankPartTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Collection\PiggybankPart::hasReminder
|
||||
* @covers FireflyIII\Collection\PiggyBankPart::hasReminder
|
||||
* @todo Implement testHasReminder().
|
||||
*/
|
||||
public function testHasReminder()
|
||||
@ -137,7 +137,7 @@ class PiggybankPartTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Collection\PiggybankPart::percentage
|
||||
* @covers FireflyIII\Collection\PiggyBankPart::percentage
|
||||
* @todo Implement testPercentage().
|
||||
*/
|
||||
public function testPercentage()
|
||||
@ -149,7 +149,7 @@ class PiggybankPartTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Collection\PiggybankPart::getCurrentamount
|
||||
* @covers FireflyIII\Collection\PiggyBankPart::getCurrentamount
|
||||
* @todo Implement testGetCurrentamount().
|
||||
*/
|
||||
public function testGetCurrentamount()
|
||||
@ -161,7 +161,7 @@ class PiggybankPartTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Collection\PiggybankPart::setCurrentamount
|
||||
* @covers FireflyIII\Collection\PiggyBankPart::setCurrentamount
|
||||
* @todo Implement testSetCurrentamount().
|
||||
*/
|
||||
public function testSetCurrentamount()
|
||||
@ -173,7 +173,7 @@ class PiggybankPartTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Collection\PiggybankPart::getCumulativeAmount
|
||||
* @covers FireflyIII\Collection\PiggyBankPart::getCumulativeAmount
|
||||
* @todo Implement testGetCumulativeAmount().
|
||||
*/
|
||||
public function testGetCumulativeAmount()
|
||||
@ -185,7 +185,7 @@ class PiggybankPartTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Collection\PiggybankPart::setCumulativeAmount
|
||||
* @covers FireflyIII\Collection\PiggyBankPart::setCumulativeAmount
|
||||
* @todo Implement testSetCumulativeAmount().
|
||||
*/
|
||||
public function testSetCumulativeAmount()
|
||||
@ -197,7 +197,7 @@ class PiggybankPartTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Collection\PiggybankPart::getAmountPerBar
|
||||
* @covers FireflyIII\Collection\PiggyBankPart::getAmountPerBar
|
||||
* @todo Implement testGetAmountPerBar().
|
||||
*/
|
||||
public function testGetAmountPerBar()
|
||||
@ -209,7 +209,7 @@ class PiggybankPartTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Collection\PiggybankPart::setAmountPerBar
|
||||
* @covers FireflyIII\Collection\PiggyBankPart::setAmountPerBar
|
||||
* @todo Implement testSetAmountPerBar().
|
||||
*/
|
||||
public function testSetAmountPerBar()
|
||||
|
@ -1,6 +1,6 @@
|
||||
<table class="table table-bordered table-striped">
|
||||
<tr>
|
||||
@if(isset($showPiggybank) && $showPiggybank === true)
|
||||
@if(isset($showPiggyBank) && $showPiggyBank === true)
|
||||
<th>Piggy bank</th>
|
||||
@endif
|
||||
<th>Date</th>
|
||||
@ -8,9 +8,9 @@
|
||||
</tr>
|
||||
@foreach($events as $event)
|
||||
<tr>
|
||||
@if(isset($showPiggybank) && $showPiggybank === true)
|
||||
@if(isset($showPiggyBank) && $showPiggyBank === true)
|
||||
<td>
|
||||
<a href="{{route('piggybanks.show',$event->piggybank_id)}}">{{{$event->piggybank->name}}}</a>
|
||||
<a href="{{route('piggyBanks.show',$event->piggyBank_id)}}">{{{$event->piggyBank->name}}}</a>
|
||||
</td>
|
||||
@endif
|
||||
<td>
|
||||
|
@ -137,8 +137,8 @@
|
||||
|
||||
</li>
|
||||
<?php
|
||||
$isMM = !(strpos($r,'piggybanks') === false) || !(strpos($r,'recurring') === false) | !(strpos($r,'repeated') === false);
|
||||
$isPiggy = !(strpos($r,'piggybanks') === false);
|
||||
$isMM = !(strpos($r,'piggy_banks') === false) || !(strpos($r,'recurring') === false) | !(strpos($r,'repeated') === false);
|
||||
$isPiggy = !(strpos($r,'piggy_banks') === false);
|
||||
$isRec = !(strpos($r,'recurring') === false) && strpos($r,'recurring.create') === false;
|
||||
$isRep = !(strpos($r,'repeated') === false);
|
||||
?>
|
||||
@ -146,7 +146,7 @@
|
||||
<a href="#"><i class="fa fa-euro fa-fw"></i> Money management<span class="fa arrow"></span></a>
|
||||
<ul class="nav nav-second-level">
|
||||
<li>
|
||||
<a @if($isPiggy)class="active"@endif href="{{route('piggybanks.index')}}"><i class="fa fa-sort-amount-asc fa-fw"></i> Piggy banks</a>
|
||||
<a @if($isPiggy)class="active"@endif href="{{route('piggy_banks.index')}}"><i class="fa fa-sort-amount-asc fa-fw"></i> Piggy banks</a>
|
||||
</li>
|
||||
<li>
|
||||
<a @if($isRec)class="active"@endif href="{{route('recurring.index')}}"><i class="fa fa-rotate-right fa-fw"></i> Recurring transactions</a>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<form style="display: inline;" id="add" action="{{route('piggybanks.add',$piggyBank->id)}}" method="POST">
|
||||
<form style="display: inline;" id="add" action="{{route('piggy_banks.add',$piggyBank->id)}}" method="POST">
|
||||
{{Form::token()}}
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
@ -1,7 +1,7 @@
|
||||
@extends('layouts.default')
|
||||
@section('content')
|
||||
{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) }}
|
||||
{{Form::open(['class' => 'form-horizontal','id' => 'store','url' => route('piggybanks.store')])}}
|
||||
{{Form::open(['class' => 'form-horizontal','id' => 'store','url' => route('piggy_banks.store')])}}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-12 col-sm-6">
|
@ -1,7 +1,7 @@
|
||||
@extends('layouts.default')
|
||||
@section('content')
|
||||
{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $piggyBank) }}
|
||||
{{Form::open(['class' => 'form-horizontal','id' => 'destroy','url' => route('piggybanks.destroy',$piggyBank->id)])}}
|
||||
{{Form::open(['class' => 'form-horizontal','id' => 'destroy','url' => route('piggy_banks.destroy',$piggyBank->id)])}}
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-12 col-sm-12">
|
||||
<div class="panel panel-red">
|
@ -1,7 +1,7 @@
|
||||
@extends('layouts.default')
|
||||
@section('content')
|
||||
{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $piggyBank) }}
|
||||
{{Form::model($piggyBank, ['class' => 'form-horizontal','id' => 'update','url' => route('piggybanks.update',$piggyBank->id)])}}
|
||||
{{Form::model($piggyBank, ['class' => 'form-horizontal','id' => 'update','url' => route('piggy_banks.update',$piggyBank->id)])}}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-12 col-sm-6">
|
@ -6,7 +6,7 @@
|
||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-fw fa-rocket"></i> <a href="{{route('piggybanks.show',$piggyBank->id)}}" title="{{{$piggyBank->name}}}">{{{$piggyBank->name}}}</a>
|
||||
<i class="fa fa-fw fa-rocket"></i> <a href="{{route('piggy_banks.show',$piggyBank->id)}}" title="{{{$piggyBank->name}}}">{{{$piggyBank->name}}}</a>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="row">
|
||||
@ -41,8 +41,8 @@
|
||||
</div>
|
||||
<div class="col-lg-8 col-md-6 col-sm-4">
|
||||
<div class="btn-group btn-group-xs">
|
||||
<a href="{{route('piggybanks.edit',$piggyBank->id)}}" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span></a>
|
||||
<a href="{{route('piggybanks.delete',$piggyBank->id)}}" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
<a href="{{route('piggy_banks.edit',$piggyBank->id)}}" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span></a>
|
||||
<a href="{{route('piggy_banks.delete',$piggyBank->id)}}" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-3 col-sm-4">
|
||||
@ -63,7 +63,7 @@
|
||||
<div class="panel-body">
|
||||
<div class="row">
|
||||
<div class="col-lg-8 col-md-6 col-sm-4 col-lg-offset-2 col-md-offset-3 col-sm-offset-4">
|
||||
<a href="{{route('piggybanks.create')}}" class="btn btn-success">Create new piggy bank</a>
|
||||
<a href="{{route('piggy_banks.create')}}" class="btn btn-success">Create new piggy bank</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -109,5 +109,5 @@
|
||||
|
||||
@stop
|
||||
@section('scripts')
|
||||
{{HTML::script('assets/javascript/firefly/piggybanks.js')}}
|
||||
{{HTML::script('assets/javascript/firefly/piggy_banks.js')}}
|
||||
@stop
|
@ -1,4 +1,4 @@
|
||||
<form style="display: inline;" id="remove" action="{{route('piggybanks.remove',$piggyBank->id)}}" method="POST">
|
||||
<form style="display: inline;" id="remove" action="{{route('piggy_banks.remove',$piggyBank->id)}}" method="POST">
|
||||
{{Form::token()}}
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
@ -8,7 +8,7 @@
|
||||
<i class="fa fa-fw fa-clock-o"></i> Events
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div id="piggybank-history"></div>
|
||||
<div id="piggy-bank-history"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -25,8 +25,8 @@
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu pull-right" role="menu">
|
||||
<li><a href="{{route('piggybanks.edit',$piggyBank->id)}}"><i class="fa fa-pencil fa-fw"></i> Edit</a></li>
|
||||
<li><a href="{{route('piggybanks.delete',$piggyBank->id)}}"><i class="fa fa-trash fa-fw"></i> Delete</a></li>
|
||||
<li><a href="{{route('piggy_banks.edit',$piggyBank->id)}}"><i class="fa fa-pencil fa-fw"></i> Edit</a></li>
|
||||
<li><a href="{{route('piggy_banks.delete',$piggyBank->id)}}"><i class="fa fa-trash fa-fw"></i> Delete</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@ -106,7 +106,7 @@
|
||||
<i class="fa fa-fw fa-clock-o"></i> Table
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
@include('list.piggybank-events')
|
||||
@include('list.piggyBank-events')
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -123,5 +123,5 @@ var piggyBankID = {{{$piggyBank->id}}};
|
||||
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
|
||||
{{HTML::script('assets/javascript/firefly/gcharts.options.js')}}
|
||||
{{HTML::script('assets/javascript/firefly/gcharts.js')}}
|
||||
{{HTML::script('assets/javascript/firefly/piggybanks.js')}}
|
||||
{{HTML::script('assets/javascript/firefly/piggy_banks.js')}}
|
||||
@stop
|
@ -14,7 +14,7 @@
|
||||
<p>
|
||||
@if(get_class($reminder->remindersable) == 'Piggybank')
|
||||
Somewhere between {{$reminder->startdate->format('j F Y')}} and {{$reminder->enddate->format('j F Y')}} you
|
||||
should deposit {{mf($amount)}} in piggy bank <a href="{{route('piggybanks.show',$reminder->remindersable_id)}}">{{{$reminder->remindersable->name}}}</a>
|
||||
should deposit {{mf($amount)}} in piggy bank <a href="{{route('piggy_banks.show',$reminder->remindersable_id)}}">{{{$reminder->remindersable->name}}}</a>
|
||||
in order to make your goal of saving {{mf($reminder->remindersable->targetamount)}} on {{$reminder->remindersable->targetdate->format('j F Y')}}
|
||||
|
||||
@endif
|
||||
|
@ -70,7 +70,7 @@
|
||||
|
||||
<!-- RELATE THIS TRANSFER TO A PIGGY BANK -->
|
||||
@if($what == 'transfer' && count($piggies) > 0)
|
||||
{{Form::ffSelect('piggybank_id',$piggies)}}
|
||||
{{Form::ffSelect('piggy_bank_id',$piggies)}}
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
@ -16,7 +16,7 @@
|
||||
associated data.
|
||||
</p>
|
||||
<p class="text-success">
|
||||
This action will not destroy categories, piggybanks, accounts, etc.
|
||||
This action will not destroy categories, piggy banks, accounts, etc.
|
||||
</p>
|
||||
<p class="text-danger">
|
||||
Are you sure?
|
||||
|
@ -68,7 +68,7 @@
|
||||
|
||||
<!-- RELATE THIS TRANSFER TO A PIGGY BANK -->
|
||||
@if($what == 'transfer' && count($piggies) > 0)
|
||||
{{Form::ffSelect('piggybank_id',$piggies,$data['piggybank_id'])}}
|
||||
{{Form::ffSelect('piggy_bank_id',$piggies,$data['piggy_bank_id'])}}
|
||||
@endif
|
||||
</div>
|
||||
</div><!-- end of panel for options-->
|
||||
|
@ -48,13 +48,13 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- events, if present -->
|
||||
@if(count($journal->piggybankevents) > 0)
|
||||
@if(count($journal->piggyBankEvents) > 0)
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
Piggy banks
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
@include('list.piggybank-events',['events' => $journal->piggybankevents,'showPiggybank' => true])
|
||||
@include('list.piggyBank-events',['events' => $journal->piggyBankEvents,'showPiggyBank' => true])
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
@ -176,11 +176,6 @@ require $framework . '/Illuminate/Foundation/start.php';
|
||||
*/
|
||||
|
||||
// do something with events:
|
||||
//Event::subscribe('Firefly\Trigger\Limits\EloquentLimitTrigger');
|
||||
//Event::subscribe('Firefly\Trigger\Piggybanks\EloquentPiggybankTrigger');
|
||||
//Event::subscribe('Firefly\Trigger\Budgets\EloquentBudgetTrigger');
|
||||
//Event::subscribe('Firefly\Trigger\Recurring\EloquentRecurringTrigger');
|
||||
//Event::subscribe('Firefly\Trigger\Journals\EloquentJournalTrigger');
|
||||
|
||||
Event::subscribe('FireflyIII\Event\Account');
|
||||
Event::subscribe('FireflyIII\Event\Budget');
|
||||
|
@ -3,20 +3,20 @@ $(function () {
|
||||
$('.removeMoney').on('click', removeMoney);
|
||||
|
||||
if (typeof(googleLineChart) == 'function' && typeof(piggyBankID) != 'undefined') {
|
||||
googleLineChart('chart/piggyhistory/' + piggyBankID, 'piggybank-history');
|
||||
googleLineChart('chart/piggy_history/' + piggyBankID, 'piggy-bank-history');
|
||||
}
|
||||
});
|
||||
|
||||
function addMoney(e) {
|
||||
var pigID = parseInt($(e.target).data('id'));
|
||||
$('#moneyManagementModal').empty().load('piggybanks/add/' + pigID).modal('show');
|
||||
$('#moneyManagementModal').empty().load('piggy_banks/add/' + pigID).modal('show');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function removeMoney(e) {
|
||||
var pigID = parseInt($(e.target).data('id'));
|
||||
$('#moneyManagementModal').empty().load('piggybanks/remove/' + pigID).modal('show');
|
||||
$('#moneyManagementModal').empty().load('piggy_banks/remove/' + pigID).modal('show');
|
||||
|
||||
return false;
|
||||
}
|
@ -131,7 +131,7 @@ class GoogleChartControllerCest
|
||||
public function piggyBankHistory(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('see the chart for the history of a piggy bank');
|
||||
$I->amOnPage('/chart/piggyhistory/1');
|
||||
$I->amOnPage('/chart/piggy_history/1');
|
||||
$I->seeResponseCodeIs(200);
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
* @SuppressWarnings("CamelCase")
|
||||
* @SuppressWarnings("short")
|
||||
*
|
||||
* Class PiggybankControllerCest
|
||||
* Class PiggyBankControllerCest
|
||||
*/
|
||||
class PiggyBankControllerCest
|
||||
{
|
||||
@ -30,7 +30,7 @@ class PiggyBankControllerCest
|
||||
public function add(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('add money to a piggy bank');
|
||||
$I->amOnPage('/piggybanks/add/1');
|
||||
$I->amOnPage('/piggy_banks/add/1');
|
||||
$I->see('Add money to New camera');
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ class PiggyBankControllerCest
|
||||
public function create(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('create a piggy bank');
|
||||
$I->amOnPage('/piggybanks/create');
|
||||
$I->amOnPage('/piggy_banks/create');
|
||||
$I->see('Create new piggy bank');
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ class PiggyBankControllerCest
|
||||
public function delete(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('delete a piggy bank');
|
||||
$I->amOnPage('/piggybanks/delete/1');
|
||||
$I->amOnPage('/piggy_banks/delete/1');
|
||||
$I->see('Delete "New camera"');
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ class PiggyBankControllerCest
|
||||
public function destroy(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('destroy a piggy bank');
|
||||
$I->amOnPage('/piggybanks/delete/1');
|
||||
$I->amOnPage('/piggy_banks/delete/1');
|
||||
$I->see('Delete "New camera"');
|
||||
$I->submitForm('#destroy', []);
|
||||
$I->see('Piggy bank "New camera" deleted.');
|
||||
@ -72,7 +72,7 @@ class PiggyBankControllerCest
|
||||
public function edit(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('edit a piggy bank');
|
||||
$I->amOnPage('/piggybanks/edit/1');
|
||||
$I->amOnPage('/piggy_banks/edit/1');
|
||||
$I->see('Edit piggy bank "New camera"');
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ class PiggyBankControllerCest
|
||||
public function editWithTargetDate(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('edit a piggy bank with a target date');
|
||||
$I->amOnPage('/piggybanks/edit/2');
|
||||
$I->amOnPage('/piggy_banks/edit/2');
|
||||
$I->see('Edit piggy bank "New clothes"');
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ class PiggyBankControllerCest
|
||||
public function index(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('view all piggy banks');
|
||||
$I->amOnPage('/piggybanks');
|
||||
$I->amOnPage('/piggy_banks');
|
||||
$I->see('Piggy banks');
|
||||
$I->see('New camera');
|
||||
}
|
||||
@ -103,7 +103,7 @@ class PiggyBankControllerCest
|
||||
public function postAdd(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('process adding money to a piggy bank');
|
||||
$I->amOnPage('/piggybanks/add/1');
|
||||
$I->amOnPage('/piggy_banks/add/1');
|
||||
$I->see('Add money to New camera');
|
||||
$I->submitForm('#add', ['amount' => 100]);
|
||||
$I->see(',00 to "New camera".');
|
||||
@ -115,7 +115,7 @@ class PiggyBankControllerCest
|
||||
public function postAddTooMuch(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('try to add too much money to a piggy bank');
|
||||
$I->amOnPage('/piggybanks/add/1');
|
||||
$I->amOnPage('/piggy_banks/add/1');
|
||||
$I->see('Add money to New camera');
|
||||
$I->submitForm('#add', ['amount' => 100000]);
|
||||
$I->see(',00 to "New camera".');
|
||||
@ -127,11 +127,11 @@ class PiggyBankControllerCest
|
||||
public function postRemove(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('process removing money from a piggy bank');
|
||||
$I->amOnPage('/piggybanks/add/1');
|
||||
$I->amOnPage('/piggy_banks/add/1');
|
||||
$I->see('Add money to New camera');
|
||||
$I->submitForm('#add', ['amount' => 100]);
|
||||
$I->see(',00 to "New camera".');
|
||||
$I->amOnPage('/piggybanks/remove/1');
|
||||
$I->amOnPage('/piggy_banks/remove/1');
|
||||
$I->see('Remove money from New camera');
|
||||
$I->submitForm('#remove', ['amount' => 50]);
|
||||
$I->see(',00 from "New camera".');
|
||||
@ -143,11 +143,11 @@ class PiggyBankControllerCest
|
||||
public function postRemoveFail(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('process removing too much money from a piggy bank');
|
||||
$I->amOnPage('/piggybanks/add/1');
|
||||
$I->amOnPage('/piggy_banks/add/1');
|
||||
$I->see('Add money to New camera');
|
||||
$I->submitForm('#add', ['amount' => 100]);
|
||||
$I->see(',00 to "New camera".');
|
||||
$I->amOnPage('/piggybanks/remove/1');
|
||||
$I->amOnPage('/piggy_banks/remove/1');
|
||||
$I->see('Remove money from New camera');
|
||||
$I->submitForm('#remove', ['amount' => 500]);
|
||||
$I->see(',00 from "New camera".');
|
||||
@ -160,7 +160,7 @@ class PiggyBankControllerCest
|
||||
public function remove(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('removing money from a piggy bank');
|
||||
$I->amOnPage('/piggybanks/remove/1');
|
||||
$I->amOnPage('/piggy_banks/remove/1');
|
||||
$I->see('Remove money from New camera');
|
||||
}
|
||||
|
||||
@ -170,7 +170,7 @@ class PiggyBankControllerCest
|
||||
public function show(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('view a piggy bank');
|
||||
$I->amOnPage('/piggybanks/show/1');
|
||||
$I->amOnPage('/piggy_banks/show/1');
|
||||
$I->see('New camera');
|
||||
}
|
||||
|
||||
@ -180,7 +180,7 @@ class PiggyBankControllerCest
|
||||
public function store(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('store a new piggy bank');
|
||||
$I->amOnPage('/piggybanks/create');
|
||||
$I->amOnPage('/piggy_banks/create');
|
||||
$I->see('Create new piggy bank');
|
||||
$I->submitForm(
|
||||
'#store', ['name' => 'Some new piggy bank',
|
||||
@ -199,7 +199,7 @@ class PiggyBankControllerCest
|
||||
public function storeAndReturn(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('store a new piggy bank and return');
|
||||
$I->amOnPage('/piggybanks/create');
|
||||
$I->amOnPage('/piggy_banks/create');
|
||||
$I->see('Create new piggy bank');
|
||||
$I->submitForm(
|
||||
'#store', ['name' => 'Some new piggy bank',
|
||||
@ -219,7 +219,7 @@ class PiggyBankControllerCest
|
||||
public function storeFail(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('fail storing a new piggy bank');
|
||||
$I->amOnPage('/piggybanks/create');
|
||||
$I->amOnPage('/piggy_banks/create');
|
||||
$I->see('Create new piggy bank');
|
||||
$I->submitForm(
|
||||
'#store', ['name' => null,
|
||||
@ -238,7 +238,7 @@ class PiggyBankControllerCest
|
||||
public function update(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('update a piggy bank');
|
||||
$I->amOnPage('/piggybanks/edit/1');
|
||||
$I->amOnPage('/piggy_banks/edit/1');
|
||||
$I->see('Edit piggy bank "New camera"');
|
||||
$I->submitForm(
|
||||
'#update', [
|
||||
@ -261,7 +261,7 @@ class PiggyBankControllerCest
|
||||
public function updateAndReturn(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('update a piggy bank and return');
|
||||
$I->amOnPage('/piggybanks/edit/1');
|
||||
$I->amOnPage('/piggy_banks/edit/1');
|
||||
$I->see('Edit piggy bank "New camera"');
|
||||
$I->submitForm(
|
||||
'#update', [
|
||||
@ -284,7 +284,7 @@ class PiggyBankControllerCest
|
||||
public function updateValidateOnly(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('validate a piggy bank');
|
||||
$I->amOnPage('/piggybanks/edit/1');
|
||||
$I->amOnPage('/piggy_banks/edit/1');
|
||||
$I->see('Edit piggy bank "New camera"');
|
||||
$I->submitForm(
|
||||
'#update', [
|
||||
@ -307,7 +307,7 @@ class PiggyBankControllerCest
|
||||
public function updateFail(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('update a piggy bank and fail');
|
||||
$I->amOnPage('/piggybanks/edit/1');
|
||||
$I->amOnPage('/piggy_banks/edit/1');
|
||||
$I->see('Edit piggy bank "New camera"');
|
||||
$I->submitForm(
|
||||
'#update', [
|
||||
@ -320,7 +320,7 @@ class PiggyBankControllerCest
|
||||
]
|
||||
);
|
||||
$I->see('Name is too short');
|
||||
$I->seeInDatabase('piggybanks', ['name' => 'New camera']);
|
||||
$I->seeInDatabase('piggy_banks', ['name' => 'New camera']);
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user