mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
First stuff for acting on reminders.
This commit is contained in:
@@ -15,6 +15,16 @@ class Reminder extends Model
|
||||
|
||||
protected $fillable = ['user_id', 'startdate', 'enddate', 'active', 'notnow', 'remindersable_id', 'remindersable_type',];
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getActiveAttribute($value)
|
||||
{
|
||||
return intval($value) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
@@ -23,6 +33,16 @@ class Reminder extends Model
|
||||
return ['created_at', 'updated_at', 'startdate', 'enddate'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getNotnowAttribute($value)
|
||||
{
|
||||
return intval($value) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\MorphTo
|
||||
*/
|
||||
@@ -43,9 +63,11 @@ class Reminder extends Model
|
||||
return $query->where('reminders.startdate', '=', $start->format('Y-m-d 00:00:00'))->where('reminders.enddate', '=', $end->format('Y-m-d 00:00:00'));
|
||||
}
|
||||
|
||||
public function scopeToday(EloquentBuilder $query) {
|
||||
public function scopeToday(EloquentBuilder $query)
|
||||
{
|
||||
$today = new Carbon;
|
||||
return $query->where('startdate','<=',$today->format('Y-m-d 00:00:00'))->where('enddate','>=',$today->format('Y-m-d 00:00:00'))->where('active',1);
|
||||
|
||||
return $query->where('startdate', '<=', $today->format('Y-m-d 00:00:00'))->where('enddate', '>=', $today->format('Y-m-d 00:00:00'))->where('active', 1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user