Skip to content

Commit

Permalink
Update installation-laravel.md
Browse files Browse the repository at this point in the history
Updated the instructions #4 for services providers registration on laravel 11 new projects
  • Loading branch information
fcontreras authored Jan 6, 2025
1 parent 545e509 commit 586bd9a
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions docs/installation-laravel.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,23 @@ Package Version | Laravel Version
Spatie\Permission\PermissionServiceProvider::class,
];
```
NOTE: If you are using laravel 11, then your providers will be located into `config/providers.php` file and you just need to add
5. **You should publish** [the migration](https://github.com/spatie/laravel-permission/blob/main/database/migrations/create_permission_tables.php.stub) and the [`config/permission.php` config file](https://github.com/spatie/laravel-permission/blob/main/config/permission.php) with:
```
return [
// ... other providers
Spatie\Permission\PermissionServiceProvider::class,
];
```
6. **You should publish** [the migration](https://github.com/spatie/laravel-permission/blob/main/database/migrations/create_permission_tables.php.stub) and the [`config/permission.php` config file](https://github.com/spatie/laravel-permission/blob/main/config/permission.php) with:
```
php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider"
```
6. BEFORE RUNNING MIGRATIONS
7. BEFORE RUNNING MIGRATIONS
- **If you are using UUIDs**, see the Advanced section of the docs on UUID steps, before you continue. It explains some changes you may want to make to the migrations and config file before continuing. It also mentions important considerations after extending this package's models for UUID capability.
Expand All @@ -55,22 +64,22 @@ Package Version | Laravel Version
- **If you are using CACHE_STORE=database**, be sure to [install Laravel's cache migration](https://laravel.com/docs/cache#prerequisites-database), else you will encounter cache errors.
7. **Clear your config cache**. This package requires access to the `permission` config settings in order to run migrations. If you've been caching configurations locally, clear your config cache with either of these commands:
8. **Clear your config cache**. This package requires access to the `permission` config settings in order to run migrations. If you've been caching configurations locally, clear your config cache with either of these commands:
php artisan optimize:clear
# or
php artisan config:clear
8. **Run the migrations**: After the config and migration have been published and configured, you can create the tables for this package by running:
9. **Run the migrations**: After the config and migration have been published and configured, you can create the tables for this package by running:
php artisan migrate
9. **Add the necessary trait to your User model**:
10. **Add the necessary trait to your User model**:
// The User model requires this trait
use HasRoles;
10. Consult the **Basic Usage** section of the docs to get started using the features of this package.
11. Consult the **Basic Usage** section of the docs to get started using the features of this package.
.
Expand Down

0 comments on commit 586bd9a

Please sign in to comment.