6ber6ou's avatar

Access to Register Page only If User Authenticate with "super admin" Role

Hi all.

By default we can access to the register page only if the user is not authenticate.

But I want allow access to the register page only if a user is authenticate and have a "super admin" role.

How can I do that without modify the "RegistersUsers" trait ?

0 likes
5 replies
michaeldyrynda's avatar

You can define the registers route manually and apply your 'super admin' middleware to it or, you can just override the method in your AuthController.

Snapey's avatar

Why register when you are already known to the system?

Are you sure its registration that you need?

sahadat5021's avatar

create a middleware for super user role and use this middleware wherever you want to give access to only super user

6ber6ou's avatar

@Snapey : Because only the super admin will be able to register users

I will add manually add the middleware to the register route

Thanks ;)

Snapey's avatar

Sorry for the delay in replying. If the admin user needs to create a user then just have them enter the details on a form and add new user to the User model

You don't need / should avoid using the Register functions - its just causing more problems and is totally the long way to go about creating a new user.

Please or to participate in this conversation.