public function scopeByDomain(Builder $query, ?Domain $domain = null): Builder 	{ 		return $query->where(static function (Builder $query) use ($domain): void { 			$query->whereNotNull('domain_id')->when($domain, static function ($query) use ($domain): void { 				$query->orWhere('domain_id', $domain->getKey()); 			}); 		}); 	}