Skip to content
Advertisement

Tag: laravel-permission

Laravel Eager Loading – Unexpected Behavior Difference between Code and Tiner

I am working on building a front-end for managing users / roles / permissions with the Spatie > Permissions package in the backend. A feature I am seeking to implement is selecting a Permission and having this selection then display all Users having the selected permission. Using php artisan tinker, I can use the statement: SpatiePermissionModelPermission::with(“roles.users”)->find(59);, with 59 representing the

Illegal offset type when assigning Permission into Role in spatie/laravel-permission using UUID

I have implemented laravel-permission to custom my Model using UUID primary key. Then I created a seeder: But, when I’m trying to assign the permission to the role using: It shows error like this when I run the seed ErrorException Illegal offset type at vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivot>Table.php:139 Then, I tried another method to assign: But, it shows another error: IlluminateDatabaseQueryException SQLSTATE[23000]: Integrity

Customizing Spatie Laravel-Permission Exception Message

I have added the Saptie Laravel Permission Package in a Laravel 5.8 API application. Every works fine and I get exception when a non admin user tries to access admin specific routes. However the default exception is rendered as HTML 403 User does not have the right roles. Considering I am using this inside an API application, I would like

Laravel 5.7 + Spatie Permissions + JWT auth

I’m setting up a REST API using Laravel 5.7. To validate authentication I JWT-auth and for permissions and roles I use Spatie. My problem: when trying to link a role to a user I get the following error The role do exist in the database: This is how I’m trying to assign a role to the user: As I’m new

Advertisement