Fix prototype access issue with model scopes property
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Garrett Mills 2021-11-25 17:02:43 -06:00
parent d245d15ad6
commit 50e0cf3090

View File

@ -194,7 +194,15 @@ export abstract class Model<T extends Model<T>> extends AppClass implements Bus
} }
} }
if ( this.prototype.scopes ) {
// Same thing here. Try to get the scopes statically, if possible
builder.withScopes(this.prototype.scopes) builder.withScopes(this.prototype.scopes)
} else if ( this.constructor.length < 1 ) {
// Otherwise, try to instantiate the model if possible and load the scopes that way
const inst = Container.getContainer().make<Model<any>>(this)
builder.withScopes(inst.scopes)
}
return builder return builder
} }