Laravel custom login and redirects for multiple roles

preview_player
Показать описание
We created a custom login system , and customized it for different roles in the application.
Рекомендации по теме
Комментарии
Автор

Another way of doing the redirection in a much simpler way is by overwriting the redirectTo method and inserting it as conditions and routes. Like bellow:

<?php

namespace App\Http\Controllers\Auth;

use Auth;

use
use Illuminate\Http\Request;
use

class LoginController extends Controller
{

use AuthenticatesUsers;

/**
* Where to redirect users after login.
*
* @return string
*/
protected function redirectTo() {
if (Auth::user()->admin)
return 'dashboard';
else
return 'home';
}
}

SaFeXTech
Автор

Nice tutorial, straight to the point. In a multi role system where every role has a (different type of) dashboard, can you not just bother about different routes,
but just present different views from the controller based on the userRole?

motolola
Автор

After login, as user then type '/dashboard' or login as admin then type '/home' on the search bar, it will be redirecting to unnecessary links. how to prevents this problem?
and your video is too good, also the way of organizing code. thanks

jahanzaibhussain
Автор

nice tuts. but please add a security for admin dashboard on this, cause some people just take what they get on the internet for granted and make their own dashboard like this on live site.

kernelpanic
Автор

Many thanks my friend, your video is so direct and simple to understand, Keep up the good work !

abusultanfahad
Автор

Hi Kati, nice tuts, thanks for sharing with everyone!
Speaking of redirecting different role users, how could this be accomplished using Laravel (with laravel/passport) as a backend API and VueJS as frontend?

sincead
Автор

can u verify the security of the pages? . i think the redirects is still not set? ..
and another thing ..can you show a tutorial editing the 'LoginController.php'' provided by the make:auth command and using it as the controller

ryan.aquino
Автор

Thank you man, you made this so simple for me

hamzasaleem
Автор

Hey I'm using laravel 5.3, and I followed your tutorial step by step. And when I ran, it's say : error exception in line 6: undefined variable : info ... ... \home.blade.php
Th

luthfi
Автор

Thanks a lot, cleanly done it, and to think I had to create another admin table. Very very helpful.

ericndungu
Автор

Good video. I have question, how to get the remember token from login? I used different table to login in, I have a table mix with social login. So how to get the token?

amirulidzham
Автор

Whats is your configuration in editor? Line spacing and font?

xXGames
Автор

Hi Kati nice tutorial, but I have some doubts... how to do a custom reset password and forgot password?

Kyrakuum
Автор

You define admin function but used it is_admin how is it working??

rezaulmasum
Автор

This answered my questions!! Thank you so much!!! More Power!

ismaelmangondato
Автор

it's possible to connect with username or email

zbeibajaafar
Автор

nice tuts...what text editor are you using?

henryugochukwu
Автор

But what about the middleware?it would be better if a user logged in he can't access the admin dashboard and if a admin logged in he can't be able to access the user dashboard ?How to do this?
@kati

mubeenali
Автор

I haven't words to thanks you.. Best one good luck

janithahashanjayawardhana
Автор

Nice video. May I know the name of your IDE and a link where I can download it ?

Elizabeth-htrx