Pushing Polymorphism to the Database
Published on by Eric L. Barnes
Adam Wathan has a new video on his blog about Pushing Polymorphism to the Database:
After my presentation at Laracon this year, a lot of people asked me how I’d take that same polymorphic approach when the objects would have to be retrieved from the database.
This screencast covers how I’d approach implementing the same idea in a real Laravel application with Eloquent, by using polymorphic relationships and delegation to accomplish the same thing without having to resort to any nasty conditionals.
The video itself is very well done and it’s a great tutorial.
Eric is the creator of Laravel News and has been covering Laravel since 2012.