diff --git a/README.md b/README.md index 272c467..528c7e1 100644 --- a/README.md +++ b/README.md @@ -450,7 +450,8 @@ class IncomeWidget extends LineChartWidget #### Role Policy -You can skip this if have set the `'register_role_policy' => true` in the config. +##### Using Laravel 10 + To ensure `RoleResource` access via `RolePolicy` you would need to add the following to your `AuthServiceProvider`: ```php @@ -462,6 +463,24 @@ protected $policies = [ ... ``` +##### Using Laravel 11 + +To ensure `RoleResource` access via `RolePolicy` you would need to add the following to your `AppServiceProvider`: + +```php +//AppServiceProvider.php +use Illuminate\Support\Facades\Gate; +... +public function boot(): void + { + ... + Gate::policy(\Spatie\Permission\Models\Role::class, \App\Policies\RolePolicy::class); + } +... +``` + +**For both Laravel 10 and 11, you can skip this if have set the `'register_role_policy' => true` in the config.** + #### Third-Party Plugins Shield also generates policies and permissions for third-party plugins and to enforce the generated policies you will need to register them in your application's `AuthServiceProvider`: