I have the following tables:
user
- id
- name
model_has_permission
- permission_id
- model_type
- model_id
permissions
- id
- name
post
- id
- title
- content
I am using Laravel 10.x with the laravel-permissions package.
Now I want to create a function in my \App\Models\Post class called users().
This function should give me all users, who have a specific permission called 'post.<id>.read'.
I am a bit confused when it comes to the different relationships so I am trying my luck here.
I tried to use morphToMany but with no success.