belongsTo(Member::class); } public function subscription() { return $this->belongsTo(Subscription::class); } public function status() { return $this->belongsTo(Status::class); } public function scopeWhereNeedsPayment($q) { return $q->whereHas('status', function($q) { return $q->needsPayment(); }); } }