Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

krunal05's avatar

Laravel 8 - Only Admin can create an account.

Hello I am new to laravel.

Need a direction where I have bunch of user roles. Only Admin can create an account and can assign different role while creating an account.

Also, Is it possible to create custom registration form without using Jetstream?

0 likes
3 replies
jlrdw's avatar
jlrdw
Best Answer
Level 75

Just have the admin the only user who can create accounts, see authorization. And yes custom is possible, it's in second part of authentication chapter, all explained there.

https://laravel.com/docs/8.x/authentication#authenticating-users

May have to scroll down a little.

You are not required to use the authentication scaffolding included with Laravel Jetstream. If you choose to not use this scaffolding, you will need to manage user authentication using the Laravel authentication classes directly. Don't worry, it's a cinch!

We will access Laravel's authentication services via the Auth facade, so we'll need to make sure to import the Auth facade at the top of the class. Next, let's check out the attempt method:

And

https://laravel.com/docs/8.x/authorization

All covered in the documentation.

1 like
krunal05's avatar

Thanks a lot. That will help me to make login with checking status as well.

if (Auth::attempt(['email' => $email, 'password' => $password, 'active' => 1])) { // The user is active, not suspended, and exists. }

But could you help me to figure out how add a user. Lets say I have a registration form with email password and role which will be lets say "artist" for now. How do I store the user with password in hash form. Also once I login how do i check (in laravel way) if user has which role.

Please or to participate in this conversation.