How to Convert Your SQL to Laravel Query Builder

You think of something and someone out there will already be workig on it. Well not always but yes most of the time.

If you are someone learning Laravel a great help is provided by Orator an online tool which converts the legacy SQL queries into Laravel database query builder version. As a learner if you can get SQL queries translated into query builder objects it is a boon as learning a new ORM is generally a challenge for most of the new developers.

What you need to do is simply enter your SQL query, and the generator returns a database query builder.

For example, take this SQL query: select posts.id, posts.title, posts.body from posts where posts.author_id = 1 order by posts.published_at DESC limit 10;