Questions tagged [laravel-permission]

Laravel permission is a 3rd party Laravel package developed by Spatie to manage user permissions and roles in a database.

Laravel permission is a 3rd party Laravel package to manage user permissions and roles in a database.

It is maintained by Spatie, a Belgian company that creates websites and web application. This is one of many Laravel packages they maintain.

It can be installed using composer via the following command:

composer require spatie/laravel-permission

Links:

261 questions
0
votes
1 answer

spatie/laravel-permission - There is no role named `admin`

I'm relatively new to Laravel and I'm try to learn spatie/laravel-permission. I'm using Laravel 10. I'm trying to seed my database with roles and a user. I'm getting this error: Spatie\Permission\Exceptions\RoleDoesNotExist There is no role named…
Fly_Moe
  • 239
  • 1
  • 2
  • 11
0
votes
1 answer

Error while installing Laravel Spatie Permission

While installing Laravel Spatie using the following command: composer require spatie/laravel-permission the following error in displayed: Click here to show the error How can I solve my problem to install Laravel Spatie ? I tried to install the…
0
votes
1 answer

Laravel 9: can't delete as super admin (spatie Laravel-permission)

I use Laravel 9 with Breeze and the package spatie Laravel-permission. I have created 2 roles and one of them is a super-admin role who should be able to do everything. class AuthServiceProvider extends ServiceProvider { /** * The model to…
Rune
  • 67
  • 1
  • 9
0
votes
1 answer

Laravel spatie/laravel-permission extending 'can' function to search additional column

I have updated the role_has_permissions table with additional column. I need to check this column when checking a permission (Basically extending "can" function as below). Is this even possible? $user->can('CREATE_INVOICE','MODULE_ID'); Also to…
rzshss
  • 95
  • 1
  • 15
0
votes
0 answers

How to call @role('admin') inside the HTML in Laravel Breeze React with Spatie/laravel-permissions

I want to create a admin dashboard with Laravel Breeze (React) and using the Spatie/laravel-permissions, I created a new project with Laravel Breeze (React) and install the Spatie/laravel-permissions. I also assigned the role to the current user in…
0
votes
0 answers

Laravel - Spatie: editing a record in DB does not work

I'm learning Laravel I am creating a form to edit the names of permissions within the Database. I created the page permission-edit.blade.php I added it to the web.php is linked with the page permissions.blade.php. The display works without any…
M1k
  • 5
  • 5
0
votes
1 answer

User-role-team based packages cannot manage authorization above the team's scope

In my application, an organization has multiple events, and a user can have multiple roles in different events, Until now it's all good I can just do a pivot relation btw user_id, role_id, event_id, But the problem is that I have some roles that are…
0
votes
1 answer

Laravel - Issues setting up Spatie Permissons - Roles Relationship Returns NULL

I have a laravel application that current has two sql db connections, the default 'mysql' connection and another 'master' connection. The default contains data for the application where the master connection contains the users, roles and…
lky
  • 1,081
  • 3
  • 15
  • 31
0
votes
0 answers

error 403 user not logged in Postman and Laravel API

I'm working on a Laravel API and using Postman to test it, I have a route /api/login that authenticates the user and return a token. Route::post('login', [ApiAuthenticationController::class, 'login']); The Login Method: class…
0
votes
1 answer

Create Duplicate role in laravel spatie-permission

i m trying to replicate role in roles tables using laravel-spatie-permission, like i have already abc role with api guard , but i want to create same role with same permission , but it's throwing error like a role 'abc' already exists for guard…
Dharmesh
  • 1
  • 1
  • 7
0
votes
1 answer

Laravel spatie , assignrole() is not working when team_id is used?

this is modified seeder code $user = User::where('id', 1)->get(); $role = Role::where('id', 1)->get(); echo $role; $user->assignRole([$role->id]); this is the…
drphp
  • 1
  • 3
0
votes
1 answer

laravel upload image in directory with custom permission

I am working on a website that uploads images in sub dir, for example, every time the user uploads an image gets stored in storage/dropzone/upload/timestamp_date/image_name.jpg the problem I faced is the image is not showing up on the client side…
0
votes
1 answer

How to bind model to the Spatie role?

Is it possibe to attach specific model to the role in Spatie laravel permissions? I need to get model depends role. For example if user has role doctor I need to get Doctor model. The same for clinic role.
Jony
  • 117
  • 7
0
votes
0 answers

Laravel Spatie - many permissions cause loading too much Models. Decreasing the amount

I wonder if there's possibility, to change a little bit the approach of the permissions. I use Spatie Roles package, where in my project I don't really use the Roles but only Permissions. Total amount of my permissions is something like 500. So…
kalview
  • 135
  • 2
  • 13