From b3063dd10ac273c23236f85487b0d96ecb6b253a Mon Sep 17 00:00:00 2001 From: ankurk91 Date: Mon, 14 Oct 2019 21:35:31 +0530 Subject: [PATCH] Update upgrade guide to include HandlesAuthorization trait change --- upgrade.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/upgrade.md b/upgrade.md index 095ae64f11f..59a5c848146 100644 --- a/upgrade.md +++ b/upgrade.md @@ -79,6 +79,22 @@ The constructor signature of the `Illuminate\Auth\Access\Response` class has cha The `Illuminate\Contracts\Auth\Access\Gate` contract has received a new `inspect` method. If you are implementing this interface manually, you should add this method to your implementation. +#### The `Illuminate\Auth\Access\HandlesAuthorization` Trait + +**Likelihood Of Impact: Low** + +The `Illuminate\Auth\Access\HandlesAuthorization` trait's method `deny()` has been updated to return `\Illuminate\Auth\Access\Response`. Previously it would throw an exception. +You may need to update your policy classes to add a `return` statement like: + + public function update(User $user, Post $post) + { + if($user->role !== 'editor') { + return $this->deny("You must be an editor to edit a post.") + } + + return $user->id === $post->user_id; + } + ### Carbon