Level 1
The problem is not directly in this query, but any response has duplicates columns (as numbers)
Hi, I am trying to build relatively complex query in raw format it looks as following
select * from `news` where (`Actual` = ?) and `IDFIRM` in (select id AS idfirm from `firm` where `Block` = ?)
I got this query from toSql() method output of query builder.
Here is my php code
NewsArticle::where($request->except(self::CITY_FILTER, self::NON_BLOCKED_COMPANIES))
->whereIn(NewsArticle::FIELD_ID_FIRM, function ($query) use ($cityFilter, $onlyNonBlocked) {
$query->selectRaw('id AS idfirm')->from(Firm::TABLE_NAME)->where(Firm::FIELD_BLOCK, "=", $onlyNonBlocked);
})->get();
And if execute query directly to database it works correctly, but using laravel (lumen) I get following
{
"0": "0value",
"1": "1value",
"2": "2value",
"3": "3value",
"4": "4value",
"5": "5value",
"6": "6value",
"ID": "0value",
"IDFIRM": "1value",
"Content": "2value",
"Image": "3value",
"Actual":4value,
"DateBeginActual": "5value",
"DateEndActual": "6value"
}
Where is my fault.
Thanks
Please or to participate in this conversation.