Skip to content

Commit

Permalink
[Docs] Sync updates across branches
Browse files Browse the repository at this point in the history
  • Loading branch information
drbyte committed Sep 1, 2023
1 parent 0a35e99 commit f114682
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions docs/advanced-usage/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ In your tests simply add a `setUp()` instruction to re-register the permissions,

## Clear Cache When Using Seeders

If you are using Laravel's `LazilyRefreshDatabase` trait, you most likely want to avoid seeding permissions before every test, because that would negate the use of the `LazilyRefreshDatabase` trait. To overcome this, you should wrap your seeder in an event listener for the `MigrationsEnded` event:
If you are using Laravel's `LazilyRefreshDatabase` trait, you most likely want to avoid seeding permissions before every test, because that would negate the use of the `LazilyRefreshDatabase` trait. To overcome this, you should wrap your seeder in an event listener for the `DatabaseRefreshed` event:

```php
Event::listen(MigrationsEnded::class, function () {
Event::listen(DatabaseRefreshed::class, function () {
$this->artisan('db:seed', ['--class' => RoleAndPermissionSeeder::class]);
$this->app->make(\Spatie\Permission\PermissionRegistrar::class)->forgetCachedPermissions();
});
Expand Down
2 changes: 1 addition & 1 deletion docs/basic-usage/super-admin.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class AuthServiceProvider extends ServiceProvider
{
public function boot()
{
$this->registerPolicies();
//...

// Implicitly grant "Super Admin" role all permissions
// This works in the app by using gate-related functions like auth()->user->can() and @can()
Expand Down
4 changes: 2 additions & 2 deletions docs/installation-laravel.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ weight: 4

## Laravel Version Compatibility

This package can be used with Laravel 6.0 or higher.
Choose the version of this package that suits your Laravel version.

Package Version | Laravel Version
----------------|-----------
Expand Down Expand Up @@ -50,7 +50,7 @@ Package Version | Laravel Version
- must set `'teams' => true,`
- and (optional) you may set `team_foreign_key` name in the config file if you want to use a custom foreign key in your database for teams

- **If you are using MySQL 8**, look at the migration files for notes about MySQL 8 to set/limit the index key length, and edit accordingly.
- **If you are using MySQL 8**, look at the migration files for notes about MySQL 8 to set/limit the index key length, and edit accordingly. If you get `ERROR: 1071 Specified key was too long` then you need to do this.

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:

Expand Down

0 comments on commit f114682

Please sign in to comment.