mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-03 20:14:31 +00:00
All code for reminders based on piggy banks. I hope.
This commit is contained in:
56
app/models/Reminder.php
Normal file
56
app/models/Reminder.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Firefly\Database\SingleTableInheritanceEntity;
|
||||
|
||||
|
||||
/**
|
||||
* Class Reminder
|
||||
* // reminder for: recurring, piggybank.
|
||||
*/
|
||||
class Reminder extends SingleTableInheritanceEntity
|
||||
{
|
||||
|
||||
protected $table = 'reminders';
|
||||
protected $subclassField = 'class';
|
||||
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getDates()
|
||||
{
|
||||
return ['created_at', 'updated_at', 'startdate', 'enddate'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function piggybank()
|
||||
{
|
||||
return $this->belongsTo('Piggybank');
|
||||
}
|
||||
|
||||
public function render() {
|
||||
return '';
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function scopeValidOn($query, Carbon $date)
|
||||
{
|
||||
return $query->where('startdate', '<=', $date->format('Y-m-d'))->where('enddate', '>=', $date->format('Y-m-d'))
|
||||
->where('active', 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* User
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('User');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user