I use unit tests for explaining the SOLID principles. In each principle the specs shows how the principle is violated and needs to be refactored.
This code is inspired by the Konstantin Kudryashov presentation in LaravelCon 2014
https://www.youtube.com/watch?v=X6y-OyMPqfw
Reference for flexible repositories: (Dependency Inversion Principle) http://culttt.com/2013/07/08/creating-flexible-controllers-in-laravel-4-using-repositories/