- If you ever wanted to fetch latest posts for each category or parent entity, than please follow below code.
- In Second query, we are getting all latest threads group by “category”.
- #First Query mysql> Select id from category; #Second Query that will run mysql> select * from `threads` where `category_id` in (‘1’, ‘2’, ‘3’) group by `category_id` order by `created_at` desc
Read the full article, click here.
@LearningLaravel: “Learn how to fetch latest post for each category in Laravel
#laravel #php #angularjs #reactjs #html #css #jquery”
One of the bestselling Laravel books! Learning Laravel 5 shows you a fastest way to learn developing web applications using Laravel 5 PHP framework
Fetch latest post for each category or Parent Entity