Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.x] Update upgrade guide to include HandlesAuthorization trait change #5531

Merged
merged 1 commit into from
Oct 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

<a name="carbon-support"></a>
Expand Down