Reimplemented a routine that creates reminders. Cannot act on them yet.

This commit is contained in:
James Cole
2015-03-06 15:12:07 +01:00
parent f9c518f321
commit fc91a50979
13 changed files with 368 additions and 66 deletions

View File

@@ -1,5 +1,7 @@
<?php namespace FireflyIII\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Database\Eloquent\Model;
/**
@@ -10,6 +12,9 @@ use Illuminate\Database\Eloquent\Model;
class Reminder extends Model
{
protected $fillable = ['user_id', 'startdate', 'enddate', 'active', 'notnow', 'remindersable_id', 'remindersable_type',];
/**
* @return array
*/
@@ -26,6 +31,17 @@ class Reminder extends Model
return $this->morphTo();
}
/**
* @param EloquentBuilder $query
* @param Carbon $date
*
* @return mixed
*/
public function scopeOnDates(EloquentBuilder $query, Carbon $start, Carbon $end)
{
return $query->where('reminders.startdate', '=', $start->format('Y-m-d 00:00:00'))->where('reminders.enddate', '=', $end->format('Y-m-d 00:00:00'));
}
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/