Doubt with the traits


#1

Greetings, I hope you can clarify a doubt about the traits, when implementing one with the structure
Model.queryMacro (‘whereNotDelete’, () => {
this.whereNull (‘deleted_at’);
return this;
});

indicates that the whereNull method is not a valid function

class UserTest {
register (Model, customOptions = {}) {


const defaultOptions = {}
const options = Object.assign(defaultOptions, customOptions);
Model.queryMacro(‘whereNotDelete’, ()=>{
this.whereNull(‘deleted_at’);
return this;
});
}
}


#2

Because you are using an arrow function, there for this is not scoped correctly


#3

Thanks i need use function(){…}?


#4

That is correct.