Support the ongoing development of Laravel.io →
posted 10 years ago
Database
Last updated 2 years ago.
0

The solution, for anyone facing this same issue, is to make sure that you are creating an instance of Illuminate\Database\Query\Expression:

$query->addSelect(new Illuminate\Database\Query\Expression("raw mysql select statement here"));

I still don't know why $query->raw() doesn't work, but there you go.

Last updated 2 years ago.
0

Thanks Adam. I needed this today!

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.