The latestOfMany() method lets you use a 'hasMany' relation as a 'hasOne' relation, returning the latest record
- ·
- Telegram
- ·
- Newsletter
🔥 In an Eloquent model can define a relation that will get the newest (or oldest) item of another relation. Very nice!
📘 Docs: https://laravel.com/docs/8.x/eloquent-relationships#has-one-of-many
#laravel #php