vantageoy/authorized-attributes

Permit hidding attributes based on model attributes

Closed this issue · 3 comments

k8n commented

As far as I can tell, policy methods receive the model class as a parameter.

Passing the model instance itself to the policy methods would enable hiding attributes dynamically, e.g.:

    public function seeAuthorComments(User $user, Post $post)
    {
        return $user->isAuthor() || $post->is_public;
    } 

You are right, need to this.

Thanks for the PR! 💯

The change is included in version 1.0.2