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.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community