如何使用 Laravel 5.1 执行原始查询?
问题描述
所以我在我的数据库上运行了这个小查询,它在 MySQL Workbench 中运行良好.基本上,一个带有 LEFT JOIN 的 SELECT 和带有 LEFT JOIN 的 UNION.
So I have this tiny query to run on my DB and it works fine in MySQL Workbench. Basically, a SELECT with LEFT JOIN and UNION with LEFT JOIN again.
尝试将其翻译成 Laravel,但没有成功.
In tried to translate it to Laravel, with no success.
我收到错误
Builder.php 第 1249 行中的 ErrorException:未定义的属性:IlluminateDatabaseEloquentBuilder::$bindings
ErrorException in Builder.php line 1249: Undefined property: IlluminateDatabaseEloquentBuilder::$bindings
如何在 Laravel 中执行完全原始的查询或在 Laravel 中以正确的方式编写查询?
How could I execute a completely raw query in Laravel or write the query in the right manner in Laravel?
推荐答案
我在 这个主题,我对此进行了编码:
I found the solution in this topic and I code this:
这篇关于如何使用 Laravel 5.1 执行原始查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!