Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update installation-laravel.md #2786

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading