title: Extending Laravel Package Models in app, and having the package controller use them rather than the package model
body: <p>I've a whole bunch of Laravel 4 packages that provide basic functionality for things like adding simple content managed pages to an app, and another for adding customer testimonials.</p>
  
  <p>The packages include the migrations, models, controllers, routes and sample views and partials that make adding them to a project really quick and easy.</p>
  
  <p>In my current project, I have to add a belongsTo relationship from pages to testimonials to show a relevant testimonial on specific pages, as selected through the CMS.</p>
  
  <p>I have created a migration to add the field to the pages table, extended the pages package model in my app and added the relationship, and configured the CMS package config file to use my model rather the package's.</p>
  
  <p>The issue I've got now though is the package controller's show method that renders a page given a slug, uses the package's model, rather than the one in my app, that extends the package model.</p>
  
  <p>What's the best way of getting the <a href="https://github.com/FbF/Laravel-Pages/blob/master/src/controllers/PagesController.php" rel="nofollow">package controller</a> to use my app's model, rather than the one in the package?</p>
  
  <p>I thought maybe I could update the package (since it is mine) to add the name of the namespaced model file to the config file for the package, which I could then change to my app's model file in my app's version of that config file, and update the package controller to look in the config file instead of hardcoding the name of the package model?</p>
  
  <p>Or maybe I should use the IoC container somehow, but I'm not sure exactly how to go about that? Maybe add a constructor which expects an instance of the package model to be injected into it, but then how to I get the IoC container to inject my app's model instead of the package's model? Does anyone have any advice?</p>