observe loopback code example
Example 1: hook access loopback
Model.observe('access', function logQuery(ctx, next) {
console.log('Accessing %s matching %s', ctx.Model.modelName, ctx.query.where);
next();
});
Example 2: loopback get relationship in before save
// it is not availabe in the "before save" event.
// you must do a Model.find()