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;
}
jaripekkala commented
You are right, need to this.
jaripekkala commented
Thanks for the PR! 💯
jaripekkala commented
The change is included in version 1.0.2