More cleanup for budgets.

This commit is contained in:
James Cole
2016-05-06 06:15:46 +02:00
parent adf6691470
commit 6d944ec98f
9 changed files with 641 additions and 441 deletions

View File

@@ -1,6 +1,8 @@
<?php namespace FireflyIII\Models;
use Auth;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@@ -59,6 +61,28 @@ class LimitRepetition extends Model
return $this->belongsTo('FireflyIII\Models\BudgetLimit');
}
/**
*
* @param Builder $query
* @param Carbon $date
*
*/
public function scopeAfter(Builder $query, Carbon $date)
{
$query->where('limit_repetitions.startdate', '>=', $date->format('Y-m-d 00:00:00'));
}
/**
*
* @param Builder $query
* @param Carbon $date
*
*/
public function scopeBefore(Builder $query, Carbon $date)
{
$query->where('limit_repetitions.enddate', '<=', $date->format('Y-m-d 00:00:00'));
}
/**
* @param $value
*/