Check user type in laravel

2020-04-01 00:40:25 Sharad Jaiswal Laravel

Add a type field in your auth table, once you added it save user type and check user type in Laravel using below code


\Auth::user()->type // Returns logged in user type


Redirect user on basis of user type in Laravel


if(\Auth::user()->type=='contibruter'){

return Redirect::to('/dashboard/contributer');

}else{

return Redirect::to('/dashboard/visitor');

}

This post is submitted by one of our members. You may submit a new post here.

Related Tricks