On the Laravel News site there's a new post sharing twenty Eloquent tips for the Laravel users out there.
Eloquent ORM seems like a simple mechanism, but under the hood, there’s a lot of semi-hidden functions and less-known ways to achieve more with it. In this article, I will show you a few tricks.
Among the tips and "hidden features" mentioned are tips about:
- Increments and Decrements
- Model boot() method
- Model properties: timestamps, appends etc.
- Order by relationship
- Order by Mutator
- Raw query methods
- Create additional things when creating a model
...and many more. There's code examples for each of them showing them in use too.