laravel - creating different type of users -
im creating app haves 2 type of users (employers , candidates). in app have 4 tables (users, candidates, employers, account_types),
users table : - email, - name, - surname, - password - account_type candidates table: - id; - user_id - other columns employers table: - id; - user_id - other columns accounts_type: -id; - title
so have 2 different routes each type of user, if candidate "domain.com/candidate/register" , if employer "domain.com/employer/register". im looking @ ready code laravel im kinda strugglying right way it. im on authcontroller looking @ function create, need create 1 more record, beside record users table, need example if employer, create record , insert in employers table , vice versa if candidate. need first check type of account being passed, thought in using hidden field in registration form indentify in create function type of user , create conditionals in create function, dont think approach. can guide me in best way in passing type of user in registration without create 2 different registrations controllers or functions , not passing hidden fields on form?
here had placed them in database table. use same thing normal users , admin in application. doing using in controller.
use illuminate\support\facades\auth; $user_type = auth::user()->account_type; //i hope used 0 , 1 2 different accounts //0 employer , 1 candidate if ($user_type==1) { return view('domain.com/candidate/register'); }else{ return redirect('domain.com/employer/register')); }
i hope you.
Comments
Post a Comment