Check user type in laravel

2024-03-19 11:14:18 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