kiritokatklian / nova-permission

A Laravel Nova tool for Spatie's laravel-permission library
https://novapackages.com/packages/vyuldashev/nova-permission
MIT License
68 stars 15 forks source link

SQL error in user index #1

Closed Sotiris-k closed 2 years ago

Sotiris-k commented 2 years ago

I'm on laravel 9.2 and my user index throws the SQL error below

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'model_has_roles.' in 'where clause' (SQL: select `roles`.*, `model_has_roles`.`model_id` as `pivot_model_id`, `model_has_roles`.`role_id` as `pivot_role_id`, `model_has_roles`.`model_type` as `pivot_model_type` from `roles` inner join `model_has_roles` on `roles`.`id` = `model_has_roles`.`role_id` where `model_has_roles`.`model_id` = 1 and `model_has_roles`.`model_type` = App\Models\User and `model_has_roles`.`` is null and (`roles`.`` is null or `roles`.`` is null))

Anyone facing the same problem?

Sotiris-k commented 2 years ago

I found the problem. during the upgrade to laravel-permissions v5, the $teams variable inside config/permission.php was set to true while the migration that had been run before that, for laravel-permission v4, didn't support it.