I have two tables (and corresponding Models) as following:
posts (
    id            auto_increment,
    category_id   refrences_id_on_categories,
    data          json
    date          timestamp
)
and
categories (
    id            auto_increment,
    name          text
)
I could get 5 posts using:
Post::orderBy('category_id', 'asc')->take(5)->get();
But, Is there any way to get 5 posts of each Category using Eloquent (Laravel 5, dbms: postgres)?
Edit i'm looking for a one line solution such as using GROUP BY or other clauses.
 
     
    