firefly-iii/app/lib/FireflyIII/Database/Recurring.php

153 lines
3.3 KiB
PHP
Raw Normal View History

2014-10-29 04:30:52 -05:00
<?php
namespace FireflyIII\Database;
use Carbon\Carbon;
2014-11-12 15:21:48 -06:00
use FireflyIII\Exception\NotImplementedException;
2014-10-29 04:30:52 -05:00
use Illuminate\Support\Collection;
use LaravelBook\Ardent\Ardent;
2014-10-30 13:26:28 -05:00
use FireflyIII\Database\Ifaces\CommonDatabaseCalls;
use FireflyIII\Database\Ifaces\CUD;
use FireflyIII\Database\Ifaces\RecurringInterface;
2014-10-29 04:30:52 -05:00
/**
* Class Recurring
*
* @package FireflyIII\Database
*/
class Recurring implements CUD, CommonDatabaseCalls, RecurringInterface
{
use SwitchUser;
/**
*
*/
public function __construct()
{
$this->setUser(\Auth::user());
}
/**
* @param \RecurringTransaction $recurring
* @param Carbon $start
* @param Carbon $end
2014-10-29 04:30:52 -05:00
*
* @return \TransactionJournal|null
*/
public function getJournalForRecurringInRange(\RecurringTransaction $recurring, Carbon $start, Carbon $end)
{
return $this->getUser()->transactionjournals()->where('recurring_transaction_id', $recurring->id)->after($start)->before($end)->first();
}
2014-11-12 15:21:48 -06:00
/**
* Returns all objects.
*
* @return Collection
*/
public function get()
{
return $this->getUser()->recurringtransactions()->get();
}
2014-10-29 04:30:52 -05:00
/**
* @param Ardent $model
*
* @return bool
*/
public function destroy(Ardent $model)
{
// TODO: Implement destroy() method.
2014-11-12 15:21:48 -06:00
throw new NotImplementedException;
2014-10-29 04:30:52 -05:00
}
/**
* Validates a model. Returns an array containing MessageBags
* errors/warnings/successes.
*
* @param Ardent $model
*
* @return array
*/
public function validateObject(Ardent $model)
{
// TODO: Implement validateObject() method.
2014-11-12 15:21:48 -06:00
throw new NotImplementedException;
2014-10-29 04:30:52 -05:00
}
/**
* Validates an array. Returns an array containing MessageBags
* errors/warnings/successes.
*
* @param array $model
*
* @return array
*/
public function validate(array $model)
{
// TODO: Implement validate() method.
2014-11-12 15:21:48 -06:00
throw new NotImplementedException;
2014-10-29 04:30:52 -05:00
}
/**
* @param array $data
*
* @return Ardent
*/
public function store(array $data)
{
// TODO: Implement store() method.
2014-11-12 15:21:48 -06:00
throw new NotImplementedException;
2014-10-29 04:30:52 -05:00
}
/**
2014-11-12 15:21:48 -06:00
* @param Ardent $model
* @param array $data
2014-10-29 04:30:52 -05:00
*
2014-11-12 15:21:48 -06:00
* @return bool
2014-10-29 04:30:52 -05:00
*/
2014-11-12 15:21:48 -06:00
public function update(Ardent $model, array $data)
2014-10-29 04:30:52 -05:00
{
2014-11-12 15:21:48 -06:00
// TODO: Implement update() method.
throw new NotImplementedException;
2014-10-29 04:30:52 -05:00
}
/**
2014-11-12 15:21:48 -06:00
* Returns an object with id $id.
2014-10-29 04:30:52 -05:00
*
2014-11-12 15:21:48 -06:00
* @param int $id
*
* @return Ardent
2014-10-29 04:30:52 -05:00
*/
2014-11-12 15:21:48 -06:00
public function find($id)
2014-10-29 04:30:52 -05:00
{
2014-11-12 15:21:48 -06:00
// TODO: Implement find() method.
throw new NotImplementedException;
2014-10-29 04:30:52 -05:00
}
/**
* @param array $ids
*
* @return Collection
*/
public function getByIds(array $ids)
{
// TODO: Implement getByIds() method.
2014-11-12 15:21:48 -06:00
throw new NotImplementedException;
2014-10-29 04:30:52 -05:00
}
/**
* Finds an account type using one of the "$what"'s: expense, asset, revenue, opening, etc.
*
* @param $what
*
* @return \AccountType|null
*/
public function findByWhat($what)
{
// TODO: Implement findByWhat() method.
2014-11-12 15:21:48 -06:00
throw new NotImplementedException;
}
2014-10-29 04:30:52 -05:00
}