3

How to define permission in controller,to access the function For example, USER -> Joe can use the function read create update delete ,but USER -> dog can use the function only read. In which table permission can increase continuously, and define permission dynamic.

I know roles & permissions spatie but it makes the default table, which I want to use my table.

I have table permission

________________________________________________________
|   id | APP  | read | create | update | delete | group |
|------+------+------+--------+--------+--------+-------|
|    1 |   aa |   1  |    1   |    1   |   1    | admin |
|    2 |   bb |   1  |    0   |    0   |   0    | user  |
|    3 |   cc |   1  |    1   |    1   |   1    | admin |
|______|______|______|________|________|________|_______|

and i have table role

_______________________
|   id | user | group |
|------+------+-------|
|    1 |  joe | admin |
|    2 |  dog | user  |
|    3 |  cat | admin |
|______|______|_______|
Ram Chander
  • 1,088
  • 2
  • 18
  • 36

1 Answers1

0

Perhaps you could look into policies: https://laravel.com/docs/5.8/authorization#generating-policies

Klaaren1
  • 11
  • 3