Can Query Model Pivot Custom Table without field id?

I'm trying to create a Custom Table with the Pivot Model Enrollment, but I encountered an error. I don't have the id field in the enrollments pivot table. How can I modify the query without using ORDER BY id? Should I add the id field to the pivot table?

  • Error:
    SQLSTATE[42703]: Undefined column: 7 ERROR: column enrollments.id does not exist LINE 1: select * from "enrollments" order by "enrollments"."id" asc ... ^
    SELECT * FROM "enrollments" ORDER BY "enrollments"."id" ASC limit 10 OFFSET 0
Was this page helpful?