All code for reminders based on piggy banks. I hope.

This commit is contained in:
James Cole
2014-08-23 22:32:12 +02:00
parent d56c00915c
commit 6e17c805c2
28 changed files with 652 additions and 44 deletions

56
app/models/Reminder.php Normal file
View 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');
}
}