function generateEventModels(eventHooks) {
    var Photo = Bookshelf.Model.extend({
      tableName: 'photos',
      imageable: function() {
        return this.morphTo('imageable', Site, [Author, 'profile_pic']);
      }
    });

    var Site = Bookshelf.Model.extend({
      tableName: 'sites',
      photos: function() {
        return this.morphMany(Photo, 'imageable');
      },
      initialize: function() {
        this.constructor.__super__.initialize.apply(this, arguments);
        this.on('fetching', function(model, columns, options) {
          eventHooks.fetching('sites', model, columns, options);
        });
      }
    });

    var Author = Bookshelf.Model.extend({
      tableName: 'authors',
      site: function() {
        return this.belongsTo(Site);
      },
      photo: function() {
        return this.morphOne(Photo, 'imageable', 'profile_pic');
      },
      initialize: function() {
        this.constructor.__super__.initialize.apply(this, arguments);
        this.on('fetching', function(model, columns, options) {
          eventHooks.fetching('authors', model, columns, options);
        });
      }
    });

    return {
      Photo,
      Site,
      Author
    };
  }
Issue #578 - lifecycle events on pivot model for belongsToMany().through()

Here we bootstrap some models involved in a .belongsToMany().through()
relationship. The models are overridden with actual relationship methods
e.g. `lefts: function () { return this.belongsToMany(LeftModel).through(JoinModel) }`
within the tests to ensure the appropriate lifecycle events are being
triggered.