将原始SQL查询转换为Laravel雄辩 [英] Convert Raw SQL Query to Laravel Eloquent

查看:58
本文介绍了将原始SQL查询转换为Laravel雄辩的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目是内容管理系统&它的新版本将集成在Laravel框架中;而且有很多巨大的SQL查询需要转换为雄辩的语法.

My project is a content management system & a new version of it will be integrated in a Laravel framework; and there are lots of huge SQL queries which needs to be converted into eloquent syntax.

我找到了以下工具来转换我已经写好的查询转换成雄辩的语法,但这是行不通的.

I found the following tool to convert my already written queries into eloquent syntax, but it does not work.

有人可以指导我转换查询或帮助我找到可以胜任这项工作的工具吗?

Could anyone guide me to convert my queries or help me find a tool that could do the job?

请在下面找到我的查询示例(请注意,我的大多数查询看起来都很相似):

Please find below a sample of my queries (note that most of my queries look similar):

SELECT id, name, code,
       ( SELECT price FROM productprice WHERE id = p.id ) AS price,
       ( SELECT image FROM productpictures WHERE id = p.id LIMIT 1 ) 
AS image
FROM product p 
WHERE categoryid = 1

谢谢.

推荐答案

我发现了这个在线工具.它可以帮助寻找该工具的人更快地完成工作.它可能并非始终都正确.

I found this Online Tool. It can help someone who looking the tool to do the job faster. It may not correct all the time.

这篇关于将原始SQL查询转换为Laravel雄辩的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆