From f9bba4433616e848b4db1d969f32f1e9e85a0736 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Fri, 15 Jan 2021 08:36:27 +1030 Subject: [PATCH] Fix old docs references to $request --- docs/create.md | 2 +- docs/delete.md | 2 +- docs/list.md | 2 +- docs/update.md | 2 +- docs/visibility.md | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/create.md b/docs/create.md index 49fdf35..4c57266 100644 --- a/docs/create.md +++ b/docs/create.md @@ -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(); }); ``` diff --git a/docs/delete.md b/docs/delete.md index 0727c14..ad7a61b 100644 --- a/docs/delete.md +++ b/docs/delete.md @@ -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(); }); ``` diff --git a/docs/list.md b/docs/list.md index bb2ed58..306edb0 100644 --- a/docs/list.md +++ b/docs/list.md @@ -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(); }); ``` diff --git a/docs/update.md b/docs/update.md index 21ca96c..cba6c3b 100644 --- a/docs/update.md +++ b/docs/update.md @@ -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(); }); ``` diff --git a/docs/visibility.md b/docs/visibility.md index ed8e368..0811c14 100644 --- a/docs/visibility.md +++ b/docs/visibility.md @@ -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'); }); ```