Reputation: 1523
I try to do a query on a view from DB, with Laravel but I get an error, and I am not sure why.
ViewData::query()->where('page', '=', '918');
"SQLSTATE[42601]: Syntax error: 7 ERROR: zero-length delimited identifier at or near """"↵LINE 1: ...data" where "page" = $1 order by "view_full_data"."" asc lim...↵
^ (SQL: select * from "view_full_data" where "page" = 918 order by "view_full_data"."" asc limit 1000 offset 0)"
From Postgres, a working one.
Select * from view_full_data where "page = 918;
Upvotes: 0
Views: 950
Reputation: 1523
I found the problem.
From Maatwebsite\Excel I get an order_by that is not ok (Maybe because I don't have an ID column).
I had to add orderBy manually.
ViewData::query()->where("page", '=', "918")->orderBy('page', 'asc');
Upvotes: 1