Comments & Discussion
��
What about creating 2 separate middleware? RoleSturen and RoleTeacher, is it a good idea? With certain check auth()->user()->role_id != 1 or auth()->user()->role_id != 2
What about creating 2 separate middleware? RoleSturen and RoleTeacher, is it a good idea? With certain check auth()->user()->role_id != 1 or auth()->user()->role_id != 2
In middleware I suggest using Enum class to get role ID like this:
middleware('role:' . \App\Enums\RoleEnum::TEACHER->value)Readable