Skip to content
Advertisement

How to deploy relationship in pivot of three model in laravel?

I’m developing a role and permissions based on laravel framework.

I have 3 models :

JavaScript

This is pivot table

JavaScript

Now, a user can have a weblog with permission id 1,2 and another weblog with permission 1,2,3,4

How can I deploy relationships? and how can I check user permissions when managing a weblog. (middleware and …)

Advertisement

Answer

With the fact that Permission are specific to Weblog

Say the pivot table is called permission_user_weblog

JavaScript

Then you can check anywhere for whether logged in user has specific permission for a specific weblog

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement