morphTo(); } /** * @param EloquentBuilder $query * @param Carbon $start * @param Carbon $end * * @return $this */ 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')); } 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) ->where('notnow', 0); } /** * @param $value */ public function setMetadataAttribute($value) { $this->attributes['metadata'] = json_encode($value); } /** * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function user() { return $this->belongsTo('FireflyIII\User'); } }