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 README.md to reflect Laravel 11 #412

Merged
merged 2 commits into from
Sep 2, 2024
Merged
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: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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`:
Expand Down