rup
rup

Reputation: 503

Laravel Spatie Roles & Permissions: How to change default tables?

I am using Laravel Spatie Roles & Permissions and wish to change the default roles and permissions tables which power it.

I am changing the table_names values in: <laravel_project>\vendor\spatie\laravel-permission\config\permission.php

The new tables have identical columns and datatypes to the existing columns.

I then run php artisan permission:cache-reset and try to make a change to an existing role or permission but the old table is still being updated and not the new ones as specified in this config file.

What am I doing wrong?

Upvotes: 2

Views: 4500

Answers (1)

Lijesh Shakya
Lijesh Shakya

Reputation: 2540

You should never change in the vendor file because it will not save the changes whenever you use composer update. Instead you can override the default changes in the config files like:

Publishing the vendor files using the command:

php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider"

And extending into whatever you wish to Changing into desired Model and Table Name

Upvotes: 3

Related Questions