Extended budgets and limits [skip-ci]

This commit is contained in:
James Cole
2014-07-20 20:46:10 +02:00
parent 08cbd91dd9
commit 988046189d
9 changed files with 199 additions and 95 deletions

View File

@@ -11,6 +11,13 @@ namespace Firefly\Storage\Limit;
class EloquentLimitRepository implements LimitRepositoryInterface
{
public function find($limitId)
{
return \Limit::with('limitrepetitions')->where('limits.id', $limitId)->leftJoin('components', 'components.id', '=', 'limits.component_id')
->where('components.user_id', \Auth::user()->id)->first();
}
public function store($data)
{
$budget = \Budget::find($data['budget_id']);
@@ -74,8 +81,7 @@ class EloquentLimitRepository implements LimitRepositoryInterface
{
$type = \TransactionType::where('type', 'Withdrawal')->first();
$result = $budget->transactionjournals()->after($start)->
before($end)->get();
$result = $budget->transactionjournals()->after($start)->before($end)->get();
return $result;

View File

@@ -9,4 +9,6 @@ interface LimitRepositoryInterface
public function store($data);
public function getTJByBudgetAndDateRange(\Budget $budget, \Carbon\Carbon $start, \Carbon\Carbon $end);
public function find($limitId);
}