Want to access all of our courses? (36 h 00 min)
You also get:
Already a member? Login here
In middleware I suggest using Enum class to get role ID like this:
middleware('role:' . \App\Enums\RoleEnum::TEACHER->value)
Readable
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
RoleSturen
RoleTeacher
auth()->user()->role_id != 1
auth()->user()->role_id != 2
Also possible, but then you would need to create more middlewares if you have new roles. Not so flexible.
can u please make laravel 11
Hi, added to our to-do list!
Done, updated the course to Laravel 11 and to the text format!
Tell us what you like or what we can improve
Feel free to share anything you like or dislike about this page or the platform in general.
Your feedback has been received. We truly appreciate you taking the time to help us improve.
In middleware I suggest using Enum class to get role ID like this:
middleware('role:' . \App\Enums\RoleEnum::TEACHER->value)Readable
What about creating 2 separate middleware?
RoleSturenandRoleTeacher, is it a good idea? With certain checkauth()->user()->role_id != 1orauth()->user()->role_id != 2Also possible, but then you would need to create more middlewares if you have new roles. Not so flexible.
can u please make laravel 11
Hi, added to our to-do list!
Done, updated the course to Laravel 11 and to the text format!