html - What is the levels column in roles in my database for PHP laravel

700

I downloaded angular Laravel LTE template. In my database under roles there is a column called level. What is the function of this, I am new to php and laravel so I am confused.

42

Answer

Solution:

Maybe you have roles that share certain privileges, so you could assign each role a different "level" so you wouldn't have to check against a ton of roles. If 10 different roles can do some action but maybe the other 5 roles can't, it would be easy to assign those 10 roles a level of{-code-1} and keep the other 5 at level1 so you can :

if( $user->level() >= {-code-1}) {}

Instead of typing 10 different roles in the below conditional

if( $user->is('someRole|someRole|someRole|someRole|someRole|someRole|someRole|someRole|someRole|someRole|')) {
}

People are also looking for solutions to the problem: php - Return a single row as an array in Fat Free Framework does not work

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.