firefly-iii/app/lib/FireflyIII/Database/Recurring.php
2014-10-30 19:26:28 +01:00

132 lines
2.7 KiB
PHP

<?php
namespace FireflyIII\Database;
use Carbon\Carbon;
use Illuminate\Support\Collection;
use LaravelBook\Ardent\Ardent;
use FireflyIII\Database\Ifaces\CommonDatabaseCalls;
use FireflyIII\Database\Ifaces\CUD;
use FireflyIII\Database\Ifaces\RecurringInterface;
/**
* 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 $current
* @param Carbon $currentEnd
*
* @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();
}
/**
* @param Ardent $model
*
* @return bool
*/
public function destroy(Ardent $model)
{
// TODO: Implement destroy() method.
}
/**
* 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.
}
/**
* 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.
}
/**
* @param array $data
*
* @return Ardent
*/
public function store(array $data)
{
// TODO: Implement store() method.
}
/**
* Returns an object with id $id.
*
* @param int $id
*
* @return Ardent
*/
public function find($id)
{
// TODO: Implement find() method.
}
/**
* Returns all objects.
*
* @return Collection
*/
public function get()
{
return $this->getUser()->recurringtransactions()->get();
}
/**
* @param array $ids
*
* @return Collection
*/
public function getByIds(array $ids)
{
// TODO: Implement getByIds() method.
}
/**
* 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.
}
}