This is the documentation for
v5.
You can switch versions in the menu on the left/at the top.
Check your current version with the following command:
composer show spatie/laravel-permission
##Upgrade Essentials
ALL upgrades of this package should follow these steps:
-
Upgrading between major versions of this package always require the usual Composer steps:
- Update your
composer.json
to specify the new major version, such as ^6.0
- Then run
composer update
.
-
Compare the migration
file stubs in the NEW version of this package against the migrations you've already run inside your app. If necessary, create a new migration (by hand) to apply any new changes.
-
If you have made any custom Models from this package into your own app, compare the old and new models and apply any relevant updates to your custom models.
-
If you have overridden any methods from this package's Traits, compare the old and new traits, and apply any relevant updates to your overridden methods.
-
Apply any version-specific special updates as outlined below...
-
Review the changelog, which details all the changes: https://github.com/spatie/laravel-permission/blob/main/CHANGELOG.md
and/or consult the Release Notes
##Upgrading from v4 to v5
Follow the instructions described in "Essentials" above.
##Upgrading from v3 to v4
Update composer.json
as described in "Essentials" above.
##Upgrading from v2 to v3
Update composer.json
as described in "Essentials" above.
##Upgrading from v1 to v2
There were significant database and code changes between v1 to v2.
If you're upgrading from v1 to v2, there's no built-in automatic migration/conversion of your data to the new structure.
You will need to carefully adapt your code and your data manually.
Tip: @fabricecw prepared a gist which may make your data migration easier.
You will also need to remove your old laravel-permission.php
config file and publish the new one permission.php
, and edit accordingly (setting up your custom settings again in the new file, where relevant).