1
votes

I am using Laravel 5.7 with postgreSQL and nova for admin panel. I also use vyuldashev/nova-permission for handling rbac CRUD that is build on top of spatie/laravel-permission.

Everything in nova permission CRUD is fining when defining permissions or roles. But the problem is when I assign permission or role to a user, I get the following error:

[10:50:18] LOG.error: SQLSTATE[42703]: Undefined column: 7 ERROR:  column "id" does not exist
LINE 1: ... "role_id", "model_type")
values
($1, $2, $3) returning "id" ^ (SQL: insert into "model_has_roles" ("model_id", "role_id", "model_type") 
values
 (198564523584, 1, App\Models\User\User) returning "id") {"userId":198564523584,"email":"[email protected]","exception":{"errorInfo":["42703",7,"ERROR:  column \"id\" does not exist\nLINE 1: ... \"role_id\", \"model_type\") values ($1, $2, $3) returning \"id\"\n ^"]}}

I am not sure what is breaking the query exactly. And if it has anything to do with postgreSQL. Any help is appreciated.

1
Can you show the code how you add the permission to the user?Ruub
@Ruub I installed this package and everything is happening under the hood. I'm using it in other projects with mysql or mariadb without this issue: github.com/vyuldashev/nova-permissionTheDevWay

1 Answers

1
votes

The problem for me has been solved by adding auto increment id to the table that I was trying to add record (to the default migrations). seems like postgreSQL or laravel do not let you to insert to the table that does not have auto increment id based on the package code and query structure.