First off your relations with pivot tables (many-to-many) must be set as belongsToMany not hasMany (which is 1-many). Next, the easiest way to define all those relations will be by following laravel rules, which are:
pivot table is named after model in alphabetical order: permission_user, permission_role, permission_position, position_user, role_user
At last to get the permissions you need for a given user, you need to load all permission (through role, position or whatever) and then merge them, to get the result. You can't do it in a single relation like you did in the last piece of code.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.