2014-08-23 15:32:12 -05:00
|
|
|
<?php
|
|
|
|
|
2014-10-13 10:54:20 -05:00
|
|
|
use LaravelBook\Ardent\Ardent;
|
|
|
|
|
|
|
|
class Reminder extends Ardent
|
2014-08-23 15:32:12 -05:00
|
|
|
{
|
|
|
|
|
|
|
|
protected $table = 'reminders';
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function getDates()
|
|
|
|
{
|
|
|
|
return ['created_at', 'updated_at', 'startdate', 'enddate'];
|
|
|
|
}
|
|
|
|
|
2014-11-17 13:55:31 -06:00
|
|
|
/**
|
|
|
|
* A polymorphic thing or something!
|
|
|
|
*
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
|
|
*/
|
|
|
|
public function remindersable()
|
|
|
|
{
|
|
|
|
return $this->morphTo();
|
|
|
|
}
|
|
|
|
|
2014-08-23 15:32:12 -05:00
|
|
|
/**
|
|
|
|
* User
|
|
|
|
*
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
|
|
*/
|
|
|
|
public function user()
|
|
|
|
{
|
|
|
|
return $this->belongsTo('User');
|
|
|
|
}
|
2014-11-17 03:10:57 -06:00
|
|
|
|
|
|
|
public function getDataAttribute($value)
|
|
|
|
{
|
|
|
|
return json_decode($value);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param $value
|
|
|
|
*/
|
|
|
|
public function setDataAttribute($value)
|
|
|
|
{
|
|
|
|
$this->attributes['data'] = json_encode($value);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-08-23 15:32:12 -05:00
|
|
|
}
|