Eloquent ORM is probably one of features that draws the most users to Laravel. However, I find that after a bit of working with Laravel, many users don't quite get what is happening under the hood. Some users call some of this "magic" and it can seem this way.
For all I know @laravelphp Eloquent travels across space and time to get data for me. I have no idea how it works it's glorious magic.
— Mitchell Kimbrough (@snoodly) August 9, 2013
It turns out, that once you get around a few of the magical areas of Eloquent, it is relatively straightforward. The problems come when new users try to dig in past surface depth and go do something more than simple Get & Set.
To alleviate these issues, the next few weeks, I will be covering Eloquent a bit more in-depth and try to explain some of the magic that is going on under the hood. Some of the topics will include:
- Starting Up Eloquent - How things are booted up in Eloquent
- Connections - The life-blood of everything database
- To Persist or Not To Persist - Instances vs creation and such
- Static Calls?
- Building Queries
- Getting Attributes
- Setting Attributes
- Dates
- Dirtiness
- Hacking Magic Methods
If you have requests for other topics, feel free to ask them! And never be afraid to extend Eloquent into your own abstract class.