Fix old docs references to $request

This commit is contained in:
Toby Zerner 2021-01-15 08:36:27 +10:30
parent 497cd364a6
commit f9bba44336
5 changed files with 5 additions and 5 deletions

View File

@ -8,7 +8,7 @@ Optionally pass a closure that returns a boolean value.
$type->creatable(); $type->creatable();
$type->creatable(function (Context $context) { $type->creatable(function (Context $context) {
return $request->getAttribute('user')->isAdmin(); return $context->getRequest()->getAttribute('user')->isAdmin();
}); });
``` ```

View File

@ -8,7 +8,7 @@ Optionally pass a closure that returns a boolean value.
$type->deletable(); $type->deletable();
$type->deletable(function (Context $context) { $type->deletable(function (Context $context) {
return $request->getAttribute('user')->isAdmin(); return $context->getRequest()->getAttribute('user')->isAdmin();
}); });
``` ```

View File

@ -8,7 +8,7 @@ If you want to restrict the ability to list a resource type, use the `listable`
$type->notListable(); $type->notListable();
$type->listable(function (Context $context) { $type->listable(function (Context $context) {
return $request->getAttribute('user')->isAdmin(); return $context->getRequest()->getAttribute('user')->isAdmin();
}); });
``` ```

View File

@ -8,7 +8,7 @@ Optionally pass a closure that returns a boolean value.
$type->updatable(); $type->updatable();
$type->updatable(function (Context $context) { $type->updatable(function (Context $context) {
return $request->getAttribute('user')->isAdmin(); return $context->getRequest()->getAttribute('user')->isAdmin();
}); });
``` ```

View File

@ -9,7 +9,7 @@ For example, the following schema will make an email attribute that only appears
```php ```php
$type->attribute('email') $type->attribute('email')
->visible(function ($model, Context $context) { ->visible(function ($model, Context $context) {
return $model->id === $request->getAttribute('userId'); return $model->id === $context->getRequest()->getAttribute('userId');
}); });
``` ```