Skip to content

Conversation

@joevallender
Copy link
Contributor

Developers who are not using the API permissions addressed in the next section won't check tokenCan. It's just a tiny thing, but it's a little more intuitive for paste-and-change learners like myself.

Developers who are _not_ using the API permissions addressed in the next section won't check `tokenCan`. It's just a tiny thing, but it's a little more intuitive for paste-and-change learners like myself.
@joevallender
Copy link
Contributor Author

Actually, Laravel\Jetstream\HasTeams.php appears to be performing the same checks as the API permissions example.

If so, that section is no longer needed, and one example would suffice. Perhaps just the code below, to continue with the server example.

/**
 * Determine whether the user can update a server.
 *
 * @param  \App\Models\User  $user
 * @param  \App\Models\Server  $server
 * @return bool
 */
public function update(User $user, Server $server)
{
    return $user->hasTeamPermission($server->team, 'server:update');
}

If I've understood this correctly, I will further update the pull request

@taylorotwell taylorotwell merged commit e83f7c8 into laravel:master Jan 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants