Skip to content
Advertisement

How to execute raw queries with Laravel 5.1?

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.

JavaScript

In tried to translate it to Laravel, with no success.

JavaScript

I’m getting the error

ErrorException in Builder.php line 1249: Undefined property: IlluminateDatabaseEloquentBuilder::$bindings

How could I execute a completely raw query in Laravel or write the query in the right manner in Laravel?

Advertisement

Answer

I found the solution in this topic and I code this:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement