So last week I've been looking for a tool that can convert my raw SQL Statements into a Laravel Eloquent Query Builder but to no avail. So I decided to make one myself.
SQLtoEloquent is an app that lets you convert SQL Statements into Laravel Eloquent Query Builders.
Feel free to use it here:
https://jjlabajo.github.io/SQLtoEloquent/
I've set a couple of rules for accuracy.
Rules:
- Use parentheses when using BETWEEN operator. e.g. SELECT * FROM t WHERE (column_name BETWEEN value1 AND value2);
- When using ALIAS, always use the AS linking verb.
e.g. SELECT uid AS
user_id
; - Always use backticks (`) for aliases.
Top comments (3)
not working this query :(
SELECT s1.product_id,s1.totalstock,s2.totalstock as assign,s3.totalstock as warrenty,s4.totalstock as damage,s5.totalstock as missing,s6.totalstock as returnProduct FROM stock_details as s
It's good for simple queries but not suitable to handle complicated queries
amazing tool..