-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problems giving permissions to a role when the id field is a uuid type #2673
Comments
It seems to me that you are not adding your custom models to the configuration. laravel-permission/config/permission.php Lines 16 to 27 in c99dca7
|
Hi @erikn69 |
On your repo https://github.com/Aldamar/laravel-permission-problems/tree/main/app/Models, i didn't found any UUID model laravel-permission/tests/TestModels/Permission.php Lines 18 to 36 in c99dca7
laravel-permission/tests/TestModels/Role.php Lines 58 to 77 in c99dca7
|
Ty @erikn69 |
Description
After updating the migration file according to this guide , I configure my seeder to assign the default roles and permissions, so when I try to assign the permission to the role with the function
![image](https://private-user-images.githubusercontent.com/50327786/334138979-b79a4af1-e3e5-4cf6-8ebd-7226bb00e1b3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE0MTU0MTYsIm5iZiI6MTcyMTQxNTExNiwicGF0aCI6Ii81MDMyNzc4Ni8zMzQxMzg5NzktYjc5YTRhZjEtZTNlNS00Y2Y2LThlYmQtNzIyNmJiMDBlMWIzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzE5VDE4NTE1NlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTAyNTM4MDE0MmFkZTE2NzczM2VmOTZkN2JlMGFiMmI2NTBjOWMxNDM3OWQwOGQyODIxMzNlMjFkNjFkOGVjNWUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.kCXdq6P9vjHjafZ0t63pCO26BoScozT5MKXtmzCIGYQ)
$role->givePermissionTo($permission);
it shows this error:First I think it was a problem of UUID casting, so extended the model and indicate that the field must be cast to a string, but the problem reamins the same.
Steps To Reproduce
mariadb
.$table->uuid('id')->primary()->unique()->default(DB::raw('UUID()'))
for the permissions and roles tables.Example Application
https://github.com/Aldamar/laravel-permission-problems
Version of spatie/laravel-permission package:
6.7.0
Version of laravel/framework package:
v11.8.0
PHP version:
8.2
Database engine and version:
MariaDB LTS
OS: Windows/Mac/Linux version:
Debian in WSL2
The text was updated successfully, but these errors were encountered: