09-11-2017, 11:54 AM
Note that hasPerm is made to be an array so it can do multiple levels at once, so it's expecting an array.
When you go into the admin panel and click admin permissions and then click a permission, if you look at this screenshot
http://puu.sh/xx701/7a52b51a58.png
You'll see that each permission has an id on it. By default, Admin is 2. If you add others like staff and manager, they'll come in at 3 & 4. Then you have to pass the user id into either checkMenu or hasPerm.
With that array, let's say you want permission levels 2 and 4 to be able to do something, that would be
When you go into the admin panel and click admin permissions and then click a permission, if you look at this screenshot
http://puu.sh/xx701/7a52b51a58.png
You'll see that each permission has an id on it. By default, Admin is 2. If you add others like staff and manager, they'll come in at 3 & 4. Then you have to pass the user id into either checkMenu or hasPerm.
With that array, let's say you want permission levels 2 and 4 to be able to do something, that would be
Code:
if(hasPerm([2,4],$user->data()->id)){
Code:
//do something
Code:
}