Fix old docs references to $request
This commit is contained in:
parent
497cd364a6
commit
f9bba44336
|
|
@ -8,7 +8,7 @@ Optionally pass a closure that returns a boolean value.
|
|||
$type->creatable();
|
||||
|
||||
$type->creatable(function (Context $context) {
|
||||
return $request->getAttribute('user')->isAdmin();
|
||||
return $context->getRequest()->getAttribute('user')->isAdmin();
|
||||
});
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ Optionally pass a closure that returns a boolean value.
|
|||
$type->deletable();
|
||||
|
||||
$type->deletable(function (Context $context) {
|
||||
return $request->getAttribute('user')->isAdmin();
|
||||
return $context->getRequest()->getAttribute('user')->isAdmin();
|
||||
});
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ If you want to restrict the ability to list a resource type, use the `listable`
|
|||
$type->notListable();
|
||||
|
||||
$type->listable(function (Context $context) {
|
||||
return $request->getAttribute('user')->isAdmin();
|
||||
return $context->getRequest()->getAttribute('user')->isAdmin();
|
||||
});
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ Optionally pass a closure that returns a boolean value.
|
|||
$type->updatable();
|
||||
|
||||
$type->updatable(function (Context $context) {
|
||||
return $request->getAttribute('user')->isAdmin();
|
||||
return $context->getRequest()->getAttribute('user')->isAdmin();
|
||||
});
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ For example, the following schema will make an email attribute that only appears
|
|||
```php
|
||||
$type->attribute('email')
|
||||
->visible(function ($model, Context $context) {
|
||||
return $model->id === $request->getAttribute('userId');
|
||||
return $model->id === $context->getRequest()->getAttribute('userId');
|
||||
});
|
||||
```
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue