jLinux

Untitled

Dec 22nd, 2015
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let Doctor = bookshelf.Model.extend({
  2.   patients: function() {
  3.     return this.belongsToMany(Patient).through(Appointment);
  4.   }
  5. });
  6.  
  7. let Appointment = bookshelf.Model.extend({
  8.   patient: function() {
  9.     return this.belongsTo(Patient);
  10.   },
  11.   doctor: function() {
  12.     return this.belongsTo(Doctor);
  13.   }
  14. });
  15.  
  16. let Patient = bookshelf.Model.extend({
  17.   doctors: function() {
  18.     return this.belongsToMany(Doctor).through(Appointment);
  19.   }
  20. });
Advertisement
Add Comment
Please, Sign In to add comment