mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-03 03:00:14 +00:00
New chart and lots of stuff for piggy banks
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
namespace FireflyIII\Database;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Firefly\Exception\FireflyException;
|
||||
use FireflyIII\Database\Ifaces\CommonDatabaseCalls;
|
||||
use FireflyIII\Database\Ifaces\CUD;
|
||||
use FireflyIII\Database\Ifaces\PiggybankInterface;
|
||||
@@ -196,8 +197,10 @@ class Piggybank implements CUD, CommonDatabaseCalls, PiggybankInterface
|
||||
*/
|
||||
public function find($id)
|
||||
{
|
||||
// TODO: Implement find() method.
|
||||
throw new NotImplementedException;
|
||||
return \Piggybank::
|
||||
leftJoin('accounts', 'accounts.id', '=', 'piggybanks.account_id')
|
||||
->where('piggybanks.id','=',$id)
|
||||
->where('accounts.user_id', $this->getUser()->id)->first(['piggybanks.*']);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -234,6 +237,18 @@ class Piggybank implements CUD, CommonDatabaseCalls, PiggybankInterface
|
||||
throw new NotImplementedException;
|
||||
}
|
||||
|
||||
public function findRepetitionByDate(\Piggybank $piggybank, Carbon $date)
|
||||
{
|
||||
$reps = $piggybank->piggybankrepetitions()->get();
|
||||
if ($reps->count() == 1) {
|
||||
return $reps->first();
|
||||
}
|
||||
if ($reps->count() == 0) {
|
||||
throw new FireflyException('Should always find a piggy bank repetition.');
|
||||
}
|
||||
throw new NotImplementedException;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Account $account
|
||||
*
|
||||
|
@@ -164,7 +164,6 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
|
||||
*/
|
||||
public function update(Ardent $model, array $data)
|
||||
{
|
||||
var_dump($data);
|
||||
/** @var \FireflyIII\Database\TransactionType $typeRepository */
|
||||
$typeRepository = \App::make('FireflyIII\Database\TransactionType');
|
||||
|
||||
|
Reference in New Issue
Block a user