We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 58eb4b9 commit 85d59fbCopy full SHA for 85d59fb
authorization.md
@@ -343,6 +343,24 @@ public function boot(): void
343
}
344
```
345
346
+Alternatively, you may place the `UsePolicy` attribute on a model class to inform Laravel of the model's corresponding policy:
347
+
348
+```php
349
+<?php
350
351
+namespace App\Models;
352
353
+use App\Policies\OrderPolicy;
354
+use Illuminate\Database\Eloquent\Attributes\UsePolicy;
355
+use Illuminate\Database\Eloquent\Model;
356
357
+#[UsePolicy(OrderPolicy::class)]
358
+class Order extends Model
359
+{
360
+ //
361
+}
362
+```
363
364
<a name="writing-policies"></a>
365
## Writing Policies
366
0 commit comments