0

I have a question about policies in Laravel. I know I can check userrights with the function can(), as example can('edit-tasks'); But I have an app with multiple projects. So user John Doe can edit tasks on project X, but not on project Y. How can I do this in Laravel? I'm searching for a function like: can('edit_tasks', $user_id, $project_id).

How can I do this?

angelique000
  • 899
  • 3
  • 10
  • 28
  • a better approach would probably be to give each type of a user a role and check for his role in the policy itself. Defining a can() for every user seems a bit overkill and hard to maintain. – Christophvh May 08 '17 at 06:59
  • I doubt there is a ready function for this but you can define a middleware for this – Anar Bayramov May 08 '17 at 07:06

0 Answers0