-
PHP 8 brings with it named arguments. PHP7 is no longer under active support: https://www.php.net/supported-versions.php Given the release of the new teams features (and the fact php7 is no longer under active development), this could be a good opportunity to expand the API by allowing developers to pass the team id as a named argument. Example usage: In a multi-team app, with a stateless API, it may be desirable to explicitly check for permission during a model gate. public function create(User $user, Post $post)
{
$user->hasPermission('post.create',teamId: $post->team_id);
} Happy to implement this if a PR is likely to be merged! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
that will not work because |
Beta Was this translation helpful? Give feedback.
that will not work because
hasPermission
uses preloadpermissions/roles
relations, and there is awherePivot
laravel-permission/src/Traits/HasPermissions.php
Line 60 in 6a3ed62
laravel-permission/src/Traits/HasRoles.php
Line 57 in 6a3ed62