Skip to content

Commit 85d59fb

Browse files
committed
wip
1 parent 58eb4b9 commit 85d59fb

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

authorization.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,24 @@ public function boot(): void
343343
}
344344
```
345345

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+
346364
<a name="writing-policies"></a>
347365
## Writing Policies
348366

0 commit comments

Comments
 (0)