SC001 - Laravel 8 Multi Auth based on Roles
HTML-код
- Опубликовано: 15 апр 2021
- What Multiple auth system refers to? Well, as the name suggests, it is a terminology that refers to the process of login by multiple users based on roles in an application.
In general, Authentication is the security process, and it indicates acknowledging the genuine user with proper account details.
Here is the archetype of this tutorial, we will develop two users one is admin, and the other one is a regular user. Based on their roles, we will allow them to access in the app using middleware. Let us begin our work and start building our application.
This time learn Laravel 8 multi authentication tutorial. You will learn how to create multi auth system in laravel using middleware.
Multiple auth system means multiple users can log in to one application according to roles and use multiple pages.
Multiple authentications are very important in the large application of laravel projects. Authentication is the process of recognizing user and admin credentials.
Create a middleware for checking the user’s role in multiple authentications. It is an admin or normal user.
Source code:
github.com/Mbere250/Laravel-8...
For more videos:
- Integrate Admin Dashboard Template in project
• SC002 - Integrate Admi... Хобби
Best vid on roles ever. really, all i see on youtube is that they use livewire and other auth models and templates . but this vid is the best.
thanks for your efforts.
Thank you🙏
Very simply as possible, and clearly explained tutorial,
thanks
Glad it was helpful!
Thank you very much. Worked like magic
Thank you
FINALLY! I LOVE YOU MAN! THANK YOU FOR EVERYTHING YOU DID!
thank you so much justin
thank you so much
Great Work sir,
Thank You!
Million Billion Likes For You and we can't Thank you As you Should For This Awesome Great Work. Thank you Again And Again . My greetings
Ohhh! Thank you so much bro.
Omg you are a good tutor, i was totally dont know how laravel works and after i watch ur video im feeling more confident for my next assignment haha
Thank you Mr Manzi
Love from Indonesia
Wooow!. Thank you so much🙏
Thank you, Sir
I love this one !!! One of the best ones !!! thanks for this one :)
Happy to hear that! 🙏
@@irebelibrary 😍😍😍😍
Finally I have finished my task ,, Love you so much sir that i can not explain ,, I will pray for you , so that you always try to learn for us
Wooow. Thank you so much
You are most welcome,,, sir,, your tutorial was much then better,, really apriciated,, ❤️❤️❤️❤️
@@mdal-amin9762 Thank you.
Thank you!!!
Awesome sir... Thanks.
Much Appreciated.
Thank you so much
Very awesome explaining 👌
Thank you
Sir, Your videos are best on internet , hope you will make an ecommerce project!
I will try my best
Thanks a lot Bro! You won a new subscription to your channel
Thank you
thank you
supari bro
very nice. thank you very much
Thank you
Amazing content bro , keep it up ,
Thank you, I appreciate!
Great Job..!!
Thank you.
so clear and knowledgeable sir thank you so much
thank you
@@irebelibrary sir you have some adding and update and delete ?
@@marventhor285 next videos we will see, Create, Retrieve, Update and Delete.
Thank you.
Ali is a program that makes this beautiful sound
@@mohamedalsayed7552 Yeah. Balabolka
Great job.
why didn't you use the laravel-permission?
Thx
Is there a way to change roles in db,without interacting with the db directly?
tnx bro
how to modify the dashboard (profile, settings) ? please help. the css files aren't loaded in the dashboard
I love you tutorials Thank you very much
cold you please add in the login checkbox remember that no working by me.
i miss this guy.
Cyakoze muranyemeje basaza,, thanks for tuto,, natwe twabikora... add more vids, congraturations @irebelibrary
Urakoze cyane bro. ewana ndi kugerageza gukora cyane nshyiraho ama video meza.
Great work! Is there a written tutorial and/or Github repo?
Soon, this will be on github
Hi 👋 Good Job. But I'm facing an issue.
After Log in, when I'm on my dashboard, u can't access any other. It redirecting me automatically to dashboard.
How to use ..user defined roles like
Teacher and student,if role is teacher it will move to teacher dashboard and if role is student it will move to student dashboard?
Sir, can we change the boolean type data to int to auth based role? cause i already have the database and my type data for the role table is int not bolean. I try to follow your tutorial and when i check it out, it always return to login page and can't receive any data from my database. Sorry if my english is bad sir
Hi Aditya. Yes it will work perfectly.
Mine is not working, after logged out I can go back to the dashboard, why is that ?
Can I know how to put CRUD into it?....
sir, You made a video on seperate table (admin, doctor) multi auth... Can I use this process of role on those tables? would I have to be aware of anything or any change that time??
You mean multi guards authentication but (admin/doctor) table have roles?.
@@irebelibrary yes sir, just on that tutorial I also want to add roles , like in admin table ,i want moderator , editor , super admin roles adding a field "role" in the table!
@@shahriarsharar8363 I will try
@@irebelibrary yes exactly
Error : routing[admin.dashboard] not defined (this is my error)(solution?)
Can I delete the home view as well as the HomeController, and create them without authentication, because I don't want it to be part of the views that need authentication. I hope its not a silly question, lol. Other than that, thank you for a wonderful tutorial.
Yes you can.
@@irebelibrary Thank you very much.
Sir make a video of comments section in laravel ajax based.
Let s go custom login with roles
Man I need you, can you explain where the Auth::user() comes from? Is it automatically select the users table or what? Is it built in with laravel or it's because of make:auth command? Thanks man
Hi Jannus Domingo. This comes after installing auth ui:
laravel.com/docs/8.x/authentication#retrieving-the-authenticated-user
@@irebelibrary but what is Auth::user() really does? Is it selecting the users table? Thanks for replying man
@@jannusdomingo5681 yes it does select the user table that you create after intalling larevel auth:ui
@@rootnepal8793 thanks for the reply but Auth::user() doesn't need the auth command. I figured it out. Thanks man
How I fix illegal offset type error
can you teach a method directly going to admin when a admin logins , same for the user without updating the role id in databse
After registration?
Another method of admin and user registration without doing anything in role without updating in mysql
@@manishdhungana331 You can achieve this by using Multi Guards Authentication.Check here ruclips.net/video/KBA22pSeoe4/видео.html
If we are typing wrong password it doesnot redirect back to login.
This code in the login controller is not working
if (auth()->attempt(array('email' => $request->input('email'), 'password' => $request->input('password')))) {
if (auth()->user()->role == 1) {
return redirect()->route('adminDashboard')->with('success', 'Successfully logged In');
} elseif (auth()->user()->role == 2) {
return redirect()->route('userDashboard')->with('success', 'Successfully logged In');
} else {
return redirect()->route('login')->with('error', 'Incorrect Credentials');
}
}
Route middleware group is not working.
Where I'm logged in as admin then if I click browser back button then it redirects me to login screen.
============
Route::middleware(['middleware' => 'preventBackHistory'])->group(function(){
Auth::routes();
});
============
Anyway thanks. 👍
Make sure that RedirectIfAuthenticated.php is correct.
Here is the correc code:
if(Auth::guard($guard)->check() && Auth::user()->role == 1){
return redirect()->route('admin.dashboard');
}
elseif(Auth::guard($guard)->check() && Auth::user()->role == 2){
return redirect()->route('user.dashboard');
}
where is role_user?
Source code please..
Source code:
github.com/Mbere250/Laravel-8-multi-auth-based-on-Roles-with-examples