ArtisanTinkerer.github.io

Blog

View on GitHub

https://laracasts.com/series/eloquent-performance-patterns

01 Measure Performance

02 Minimise Memory Usage

add a select:

$years = Post::query
  ->select('id', 'title')

strip down related:

->with('author')

//can be 

->with('author:id,name')

useful when we have a lot of records, look at metrics

03 Get one record from a has many relationship.