@abdulbazith maybe you need a package like this one, which is an extension of the spatie package
Role and permission need to be checked dynamically not manually(this works fine) in Spatie package
Guys iam working with a project School Management System.
I used spatie-laravel-permission package for multiple authentication.
Everything works fine, i have added, user, role, permission, role->permission, user->role
All i did and i checked the permission manually like
@role('Accountant')
//Show Salary link in nav bar
@endrole
This above code works fine. But my problem is
the role and permission are dynamic, it is left to the school they will enter the roles and permissions, and the admin of the school has the permission to assign role->user, and permission->to roles.
so think that
@role('Accountant')
//Show Salary link in nav bar
@endrole
the same above code, i dont know the role name which entered by the school, so in the place of checking it is dynamic, how can i check it??
the same problem i will face in controllers, blades etc.
think that i have a nav bar like this
Role
AddRole
ManageRole
Permissions
Add Permissions
Manage Permissions
Students
Add Student
Manage student
Staff
Add Staff
ManageStadd
Student Attendance
Add attendance
Manage Attendance
Staff Attendance
Add attendance
manage attendance
Subjects
Add
manage
Exams
Add
Manage
Fee Structure
add
manage
FeePayment
add
manage
MarkDetails
Add
Manage
StaffSalary
Add
manage
Now the above all is my nav bar. here based on the user role the nav bar display will be changed. how can i check it dynamically.
say for example, a staff role have permission to use the nav bars like add mark, add subject, add exam. but dont have permission to add a student, only the office admin has the permission to add a student.
likewise a account has permission only to add fee structure, fee payment, add salary, the dont have permission to add mark, or exam, or subjects.
I have added the role and permission, everything, but checking the permission is dynamic how can i do that
how i added my role permission is like below
Staff Role->have permission to-> add_mark, add_exam, add_subject, edit_mark, edit_exam, edit_subject
Accountant Role->have permission to-> add_feepayment, edit_feepayment, add_salary, edit_salary, add_feestructure, edit_feestructure.
Just how i can check it??
@abdulbazith yup, that's what I will do. Get the data and what each role responsibility is, and code it accordingly.
Then in the future if a new feature needs to be added, and there is an extra permission for it, you create the permission and let the admin of the school assign the permission to a role or to a specific user.
Please or to participate in this conversation.