belongsTo('Piggybank'); } public function recurringTransaction() { return $this->belongsTo('RecurringTransaction'); } 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); } public function scopeValidOnOrAfter($query, Carbon $date) { return $query->where( function ($q) use ($date) { $q->where('startdate', '<=', $date->format('Y-m-d'))->where( 'enddate', '>=', $date->format('Y-m-d') ); $q->orWhere( function ($q) use ($date) { $q->where('startdate', '>=', $date); $q->where('enddate', '>=', $date); } ); } )->where('active', 1); } /** * User * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function user() { return $this->belongsTo('User'); } }