How To Make Laravel Admin Approval - laravel

im new to laravel. i want to make an admin panel with multiple role, and any role except admin that trying to CRUD, must need Admin approval to implement it. is there any library, or tutorial how to do it, please i need it to learn.
Thanks

You could try the Spatie Permissions package:
https://spatie.be/docs/laravel-permission/v3/introduction
The features you could look at to learn this are Laravel's Gates and Policies, which can be used to restrict access based on criteria.
https://laravel.com/docs/8.x/authorization

Related

How to use Laravel backpack for non admin user

In my system, there are tow types of users.
Admin.
Regular.
For admin I am using Laravel backpack. But, I also want the backpack's features for non admin panel also.
What's the way?
Usually people use Roles/Permissions to handle that.
There is a Backpack addon that will give you a kick start with cruds for user/permission/role using the Spatie Laravel Permission under the hood: https://github.com/Laravel-Backpack/PermissionManager
Then you can show some bits of your app to some users, hide some fields/columns from others etc.
Just remember that users will be authenticating using backpack guard, so you should use backpack_user()->hasRole(), or see the advanced configuration of the package in ReadMe.
Cheers

Custom Registration process to onboard other users in Laravel

I am building a Laravel webapp, where I need to implement a custom registration process. Now I am not sure, whether I can/should use the built-in Authentication features from Laravel or not.
I have three types of users:
Admin users: My colleagues in my company who talk to clients, onboard them, etc.
Clients: Users who create certain tasks, that need to be done. They could more or less use a "standard registration" process
Service Providers: Users who fulfill tasks for clients. They need to be onboarded by our company. So our admin users would create their user profile and send them an invitation link.
Especially the Service Providers are giving me a headache. Is this kind of custom registration flow possible in Laravel or do I have to build my own custom athentication to accomplish this?
Thank you for posting your question. I have implemented Laravel Authentication with custom features before, I would recommend you to take the following steps:
Install Laravel Authentication.
Update users table with a column name type that will distinguish between users.
Create middleware for each user. Middleware helps you which user can access or perform which tasks.
If you have different elements for each user then you can also implement policies or gates to show specific elements on your blade template according to user type.
I would not recommend creating custom Authentication for this scenario, as you have to implement proper session handling throttling, forgot password, verify the process along with emails and notifications. which is built-in by default in Laravel.
If you want to edit the register and login function you can do that. ;)

Laravel Admin with controller level permissions

what I want to create is Laravel 5.2 Admin and there are around 200 users who will use it with different permissions, so you can say 200 roles with different permissions.
I was planning to eliminate the role part from the picture and create some slug based mechanism, slugs will be related to controller public functions in short routes.
In Admin panel superuser will be able to assign permissions to user on controller functions with slugs.
Is this possible with any existing laravel package currently? If not then what will be the optimal solution you guys propose.
I always use Spatie Package, it is very flexible. You can manage role & permissions or only permissions. It is full of functions that make it easy. Check the documentation.
spatie-laravel-permission

Befor the Auth::check() , Where and How can I set the users access to some functionality or pages

Actually I am beginner in Laravel. By the way, I am using auth and there is a wonderful method, I mean "check" of Auth facade that enable you to protect all routes or controller in that way you want. But Befor this I should say which users can use this route or controller and which users can't.
I seach for it but I didnt find.
Actually I miss a part of this authentication mechanism in Laravel.Please help me about this.
Laravel has a feature called Middlewares where you can check for the user role based on your role_id.
Please see the below link for more clear reference.
https://laravel.com/docs/5.8/middleware
Happy Coding.:)
You need to use middleware for this kind of functionality. Read about middleware in laravel documentation here
Moreover you can use this package to create role for users if you don't want to create roles from scratch. Just add user to a role and use the role name as the middleware.
Have you gone through with ACL stuff in laravel??
Well it will work as per permission which is given by user as per it's role.
For an example Admin has all role so he can access anything. Employee has few rights to access modules so that will define as per need in laravel and that user that do not have access to use some module they'll get some error desgined by developer.
So this all handle through Middleware, and generally that defines by acl
Anything else you want to know?

How to create your own module based on laravel's authentication?

I am new to laravel and currently i am learning and experimenting on my old php based mini-project conecpt ,i have successfully created the user registration and user login with some features for users,but i am confused how do i create a admin module and provide admin privilege's along with one more sub module (moderator).
I have completed website module,it works fine but i am confused how do i give the following functionalities.
how do i add admin module
admin can access user information
only admin can add moderator
any suggestions would be helpful,
Thank you.
I think what you are trying to do is make some routes only accessible by an admin or moderator?
Make a custom middleware so only if a user has a sufficient role level they can acces the given route.
https://laravel.com/docs/5.6/middleware#defining-middleware
You could have a moderator middleware that checks if a user has role 1 or higher, and a admin middleware that checks if a user has role 2.
i hope this is somewhat what you are searching for.

Resources